network:configure_a_network_bridge
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
network:configure_a_network_bridge [2016/07/07 13:53] – peter | network:configure_a_network_bridge [2019/11/30 18:26] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Network - Configure a Network Bridge ====== | ||
- | |||
- | To bridge traffic between two or more Ethernet interfaces on Linux. | ||
- | |||
- | If you would like your virtual machines to be visible on your network and have them accept connections from other computers and devices on your network, so they appear as tho they were distinct physical machines, then you need to create what is called a Network Bridge. | ||
- | |||
- | You need to make a couple of changes to a file on the host computer. | ||
- | |||
- | <code bash> | ||
- | sudo vi / | ||
- | </ | ||
- | |||
- | The contents of your file probably looks something similar to this: | ||
- | |||
- | <file bash / | ||
- | # This file describes the network interfaces available on your system | ||
- | # and how to activate them. For more information, | ||
- | |||
- | # The loopback network interface | ||
- | auto lo | ||
- | iface lo inet loopback | ||
- | |||
- | # The primary network interface | ||
- | auto eth0 | ||
- | iface eth0 inet dhcp | ||
- | </ | ||
- | |||
- | Note: If you're currently using a fixed IP address then the **auto eth0** section of the file will look different to the above. | ||
- | |||
- | ===== How to create a network bridge using DHCP ===== | ||
- | |||
- | If you are using DHCP to allocate an IP address to your server then change the contents of the file as follows: | ||
- | |||
- | <file bash / | ||
- | # This file describes the network interfaces available on your system | ||
- | # and how to activate them. For more information, | ||
- | |||
- | # The loopback network interface | ||
- | auto lo | ||
- | iface lo inet loopback | ||
- | |||
- | # The primary network interface | ||
- | #auto eth0 | ||
- | #iface eth0 inet dhcp | ||
- | |||
- | auto br0 | ||
- | iface br0 inet dhcp | ||
- | bridge_ports eth0 | ||
- | bridge_fd 9 | ||
- | bridge_hello 2 | ||
- | bridge_maxage 12 | ||
- | bridge_stp off | ||
- | </ | ||
- | |||
- | Don't forget to mask out the auto eth0 and iface eth0 inet dhcp lines. | ||
- | |||
- | Once you've made the changes then save the file. | ||
- | |||
- | Once you've made the changes to the file then issue the following command to make them active: | ||
- | |||
- | <code bash> | ||
- | sudo / | ||
- | </ | ||
- | |||
- | |||
- | ===== How to create a network bridge using a static IP address. ===== | ||
- | |||
- | If you are currently using a static IP address for your server or you wish to switch to using a static IP address for your server then change the contents of the file as follows: | ||
- | |||
- | Obviously you must substitute the values for address, broadcast, netmask & gateway to those applicable to your own network. | ||
- | |||
- | <file bash / | ||
- | # This file describes the network interfaces available on your system | ||
- | # and how to activate them. For more information, | ||
- | |||
- | # The loopback network interface | ||
- | auto lo | ||
- | iface lo inet loopback | ||
- | |||
- | # The primary network interface | ||
- | #auto eth0 | ||
- | #iface eth0 inet dhcp | ||
- | |||
- | auto br0 | ||
- | iface br0 inet static | ||
- | address 192.168.1.200 | ||
- | broadcast 192.168.1.255 | ||
- | netmask 255.255.255.0 | ||
- | gateway 192.168.1.254 | ||
- | bridge_ports eth0 | ||
- | bridge_fd 9 | ||
- | bridge_hello 2 | ||
- | bridge_maxage 12 | ||
- | bridge_stp off | ||
- | </ | ||
- | |||
- | Don't forget to mask out the auto eth0 and iface eth0 inet dhcp lines. | ||
- | |||
- | Once you've made the changes then save the file. | ||
- | |||
- | Once you've made the changes to the file then issue the following command to make them active: | ||
- | |||
- | <code bash> | ||
- | sudo / | ||
- | </ | ||
network/configure_a_network_bridge.1467899582.txt.gz · Last modified: 2020/07/15 09:30 (external edit)