-
Notifications
You must be signed in to change notification settings - Fork 29
How to create bridge for InfraSIM
ForrestGu edited this page Feb 22, 2017
·
9 revisions
Two method to create a bridge:
- Create in commandline by
brctl
- Edit
/etc/network/interfaces
and give control to OS
Make <nic interface>
to be a device just forward packet, and enable its promiscuous mode:
sudo ifconfig <nic interface> 0.0.0.0
sudo ifconfig <nic interface> promisc
Then leverage the <nic interface>
to build your bridge <bridge name>
:
sudo apt-get install bridge-utils
brctl addbr <bridge name>
brctl addif <bridge name> <nic interface>
brctl setfd <bridge name> 0
brctl sethello <bridge name> 1
brctl stp <bridge name> no
sudo ifup <bridge name>
Note: When creating bridge for InfraSIM, the current network connectivity will be disconnected.
The file location is usually /etc/network/interfaces
, you can refer to below example to define your bridge:
auto ens192
iface ens192 inet static
address 0.0.0.0
post-up ifconfig ens192 promisc
auto br0
iface br0 inet dhcp
bridge_ports ens192
bridge_fd 0
bridge_hello 1
bridge_stp off
Be careful about the line post-up ifconfig ens192 promisc
, it makes PXE packet possible to go through ens192 and finally reach qemu.
After you've written this file, run following command to restart your network:
sudo /etc/init.d/networking restart