In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how to build a bridge on Ubuntu related knowledge, detailed and easy to understand, simple and fast operation, has a certain reference value, I believe that everyone will have a harvest after reading this article on how to build a bridge on Ubuntu, let's take a look at it.
The purpose of a bridge is to connect internal and external networks through physical interfaces. This is useful for virtual ports or LXC/KVM/Xen/containers. A bridge virtual port appears to be a regular device on the network. This article will share with you how to build bridges on Ubuntu.
Examples of Bridged Networks
Figure 01: Kvm/Xen/LXC container bridge example (br0)
In this example, eth0 and eth2 are physical network interfaces. eth0 is connected to the local area network, and eth2 is connected to the upstream router and the Internet.
Install bridge-utils
Use the apt-get command to install bridge-utils:
$ sudo apt-get install bridge-utils
or
$ sudo apt install bridge-utils
Sample output:
Figure 02: Ubuntu installing the bridge-utils package
Create a bridge on an Ubuntu server
Modify using your familiar text editor
/etc/network/interfaces
For example vi or nano:
$ sudo cp /etc/network/interfaces /etc/network/interfaces.bakup-1-july-2016$ sudo vi /etc/network/interfaces
Next set eth2 and map it to br1 by typing (delete or comment all eth2 related configuration):
### br1 Use static public IP addresses and ISP routers as gateways auto br1iface br1 inet static address 208.43.222.51 network 255.255.255.248 netmask 255.255.255.0 broadcast 208.43.222.55 gateway 208.43.222.49 bridge_ports eth2 bridge_stp off bridge_fd 0 bridge_maxwait 0
Next set eth0 and map it to br0 by typing (delete or comment all eth0 related configuration):
auto br0iface br0 inet static address 10.18.44.26 netmask 255.255.255.192 broadcast 10.18.44.63 dns-nameservers 10.0.80.11 10.0.80.12 # set static route for LAN post-up route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.18.44.1 post-up route add -net 161.26.0.0 netmask 255.255.0.0 gw 10.18.44.1 bridge_ports eth0 bridge_stp off bridge_fd 0 bridge_maxwait 0
A note on br0 and DHCP
If DHCP is used, the configuration options are as follows:
auto br0iface br0 inet dhcp bridge_ports eth0 bridge_stp off bridge_fd 0 bridge_maxwait 0
Save and close the file.
Restart the server or network service
You need to restart the server or type the following command to restart the network service (this may not work in SSH login sessions):
$ sudo systemctl restart networking
If you are using Ubuntu 14.04 LTS or older systems without systemd, enter:
$ sudo /etc/init.d/restart networking
Verify network configuration successful
Use ping/ip to verify that LAN and WAN network interfaces are functioning properly:
###View br0 and br1ip a show###View routing information ip r### ping external site ping -c 2 cyberciti.biz### ping local area network server ping -c 2 10.0.80.12
Sample output:
Figure 03: Verify Ethernet connectivity of the bridge
You can now configure br0 and br1 to allow XEN/KVM/LXC containers to access the Internet or a private local area network. There is no longer any need to set SNAT rules for specific routes or iptables.
The content of this article on "How to build bridges on Ubuntu" is introduced here. Thank you for reading! I believe everyone has a certain understanding of "how to build bridges on Ubuntu" knowledge. If you still want to learn more knowledge, please pay attention to the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.