We focus on the two-way relay system design under two different settings. In the first setting, we have a two-way relay channel (TWRC) with two single-antenna source nodes, S1 and S2, exchanging information through one assisting multi-antenna relay node, R. It is assumed that R receives the sum signal from S1 and S2 in one time-slot, and then amplifies and forwards the received signal to both S1 and S2 in the next time-slot. By applying the principle of analogue network coding (ANC), each of S1 and S2 cancels the so-called "self-interference" in the received signal from R and then decodes the desired message. We then analyze the maximum achievable rate region of the ANC-based TWRC with linear processing (beamforming) at R via convex optimization techniques. We derive the optimal relay beamforming structure by solving a non-convex problem via SDP relaxation, and show that we could reconstruct the exact optimal rank-one beamforming structure from the relaxed solution for the originally non-convex problem. In the second setting, we have a distributed two-way relay system, where two single-antenna source nodes, S1 and S2, exchange information through a group of single-antenna relays. In particular, for the case with a sum power constraint, we give the closed-form solution by exploring the underlying relationship between the rate region and the inverse-SNR region. For the case with individual power constraints, we also give out the closed-from solution, which shows that relays with bad channel gains and large local noises should keep silent.