Linux virtual bridge experiment

Linux virtual bridge experiment

A, experimental background
bridge: a plurality of LAN data link layer connected together to achieve mutual communication between LAN. At the same time the broadcast can be isolated

experiment procedure

Before the experiment only one computer can access, after the experiment, two computers can access.
First of all -> Virtual Network Editor -> Add network -> VMnet3 host-only mode
to view IP: ifconfig route also remember that behind the configuration required to use.
(1) pc1 virtual bridge to install the software:

sudo apt-get install bridge-utils

(2) network-manager uninstall

sudo apt-get purge network-manager

(3) modify the network card configuration:

sudo gedit /etc/network/interfaces

Add the following (remember to modify it):

auto eth0
iface eth0 inet static
    address 0.0.0.0
auto eth1
iface eth1 inet static
    address 0.0.0.0
auto br0
iface br0 inet static
    address 192.168.206.128
    netmask 255.255.255.0
    gateway 192.168.206.2
    broadcast 192.168.206.255
    dns-nameservers 192.168.206.2 192.168.30.1
    bridge_ports eth0 eth1

pc1 Adding Bridge

sudo brctl addbr br0

Restart Interface

sudo ifdown br0 && ifup br0

pc2 uninstall network-manager:

sudo apt-get purge network-manager

pc2 configure a static ip:

sudo gedit /etc/network/interfaces

Add the following:

auto eth0
iface eth0 inet static
address 192.168.206.129
netmask 255.255.255.0
gateway 192.168.206.2
broadcast 192.168.206.255
dns-nameservers 192.168.206.2

Experimental procedure Screenshot:

Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description
Here Insert Picture Description

Test results

ping www.baidu.com
Here Insert Picture Description

Published 16 original articles · won praise 1 · views 546

Guess you like

Origin blog.csdn.net/m0_43455210/article/details/103604265