Bridging Scheme of Wireless Router

Bridging Scheme of Wireless Router

Application scenario

Conditions:

First, we have a Wi-Fi with Internet access. Let's assume wifi.

Now we have two routers A and B, two servers SA and SB, and one router on each server.

Objective:

Connecting to A through a computer, we can log in to the server SA and have access to the Internet in SA.

 

Open the Router A configuration page. I use tplink here.

Setting mode

Next, let's choose the wifi to bridge.

Open the wifi list and connect to the wifi we want

Then set the name and encryption key, and click Next, you may see a hint, because the wifi you selected uses 13 channels, so you also need to set your router to 13 channels.

OK, Modified to 13 Channels

Next, enter the router login password

Prompt for reboot

Waiting for the reboot to complete, login to Router A Management Page

 OK

Router A bridges to wifi and is configured.

 

 

Next, configure the network card of Server A

SA has four ports. Let's assume that the fourth port is dhcp.

A is connected to the fourth network port of SA through the network cable, and the first three ports can be bridged to a bridge br0.

xxx@hostname:~$ ifconfig
br0       Link encap:Ethernet  HWaddr 00:e0:4c:68:35:cb  
          inet addr:192.168.10.10  Bcast:192.168.10.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

p1p1      Link encap:Ethernet  HWaddr 00:e0:4c:68:35:cb  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Memory:d0800000-d081ffff 

p2p1      Link encap:Ethernet  HWaddr 00:e0:4c:68:35:cc  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Memory:d0700000-d071ffff 

p3p1      Link encap:Ethernet  HWaddr 00:e0:4c:68:35:cd  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Memory:d0600000-d061ffff 

p4p1      Link encap:Ethernet  HWaddr 00:e0:4c:68:35:ca  
          inet addr:192.168.1.199  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::2e0:4cff:fe68:35ca/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1137 errors:0 dropped:66 overruns:0 frame:0
          TX packets:471 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:505826 (505.8 KB)  TX bytes:44957 (44.9 KB)
          Memory:d0900000-d091ffff 

We see that the fourth port has an IP of 192.168.1.199.

Next, set up the network card

sudo vi /etc/network/interfaces, the following is my configuration file. This machine has four network ports, p1p1, p2p1, p3p1, p4p1.

The first three bridges are a bridge br0 and p4p1 is fixed IP 192.168.1.199.

And the gateway of P4P 1 in the configuration file should be set up to be the same as the gateway of wifi. Here I am 192.168.199.1.

Content of the document:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo br0
iface lo inet loopback

                                                                                                                                                                                 
iface p1p1 inet manual
iface p2p1 inet manual
iface p3p1 inet manual
#iface p4p1 inet manual
auto p4p1
iface p4p1 inet static
address 192.168.1.199
gateway 192.168.1.1
netmask 255.255.255.0


# Bridge setup
iface br0 inet static
bridge_ports p1p1 p2p1 p3p1
        address 192.168.10.10
        broadcast 192.168.10.255
        netmask 255.255.255.0
        gateway 192.168.10.1

Then, we restart the server to make the network configuration work.

We connect to A through a computer, then remotely to the server SA, and then try to see if we can get online.

xxx@hostname:~$ ping www.baidu.com
PING www.a.shifen.com (39.156.66.18) 56(84) bytes of data.
64 bytes from 39.156.66.18: icmp_seq=1 ttl=52 time=14.5 ms
64 bytes from 39.156.66.18: icmp_seq=2 ttl=52 time=11.5 ms
64 bytes from 39.156.66.18: icmp_seq=3 ttl=52 time=61.6 ms
64 bytes from 39.156.66.18: icmp_seq=4 ttl=52 time=153 ms
64 bytes from 39.156.66.18: icmp_seq=5 ttl=52 time=38.4 ms
64 bytes from 39.156.66.18: icmp_seq=6 ttl=52 time=135 ms
^C
--- www.a.shifen.com ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5005ms
rtt min/avg/max/mdev = 11.505/69.104/153.322/55.871 ms

 

 

Relevant orders:

demo:
#The primary network interface
auto eth0
iface eth0 inet static
address 192.168.1.199
gateway 192.168.1.1
netmask 255.255.255.0
#network 192.168.1.0
#broadcast 1921.68.1.255


//Setting IP Address and Subnet Mask of Network Card eth0
sudo ifconfig eth0 192.168.2.1 netmask 255.255.255.0


//Restart network services (if not, restart ubuntu: sudo reboot)
sudo /etc/init.d/networking restart


Ubuntu14.04 Setting up gateway
sudo route add default gw 192.168.1.1


#View routing information
higgs@HiggsDynamics:~$ route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.1.1     0.0.0.0         UG    0      0        0 p4p1
192.168.1.0     *               255.255.255.0   U     0      0        0 p4p1
192.168.10.0    *               255.255.255.0   U     0      0        0 br0

Keywords: PHP network sudo Ubuntu

Added by alsinha on Wed, 29 May 2019 22:18:39 +0300