How to Create Bridge Networking in Linux

Tags: February 1, 2014 1:47 PM

Two user space tools used for creating bridge networking in linux are tunctl and brctl. tunctl used for simulating the network or link layer device and brctl for configuring them.

Create the TAP interface

Issue command below to create tap interface and then activate the tap.
tunctl -t vtap01 -u myuser
ip link set up dev vtap01
# or
ifconfig vtap01 up

Create the Bridge

Issue command below to configure the bridge for using the TAP interface which just created.
brctl addbr vbr01
brctl addif vbr01 vtap01

Assign IP and Routing to the Bridge

Make the bridge identified by others such as another computers or VMs (Assuming the network is 192.168.1.0/30).
ip link set up dev vbr01
ip addr add 192.168.1.1/30 dev vbr01
ip route add 192.168.1.0/30 dev vbr01
or it could be written as:
ifconfig vbr01 up
ifconfig vbr01 192.168.1.1 netmask 255.255.255.252
route add -net 192.168.1.0 netmask 255.255.255.252 dev vbr01
The host at 192.168.1.2 should be able to ping host 192.168.1.1 (via bridge).

References

Share on Facebook Twitter

0 comments:

Post a Comment