In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Sometimes one network interface is not enough. Network binding allows multiple network connections to work with a single logical interface. You may do this because you need more bandwidth for a single connection, or you may want to switch back and forth between wired and wireless networks without losing the network connection.
I am the latter case. One of the advantages of working from home is that when the weather is clear, it is pleasant to work on a sunny balcony instead of indoors. But every time I do this, I lose my Internet connection. IRC, SSH, VPN, everything is disconnected and it will take at least a while for the client to reconnect. This article describes how to set up a network binding on a Fedora 30 laptop to seamlessly switch from the wired connection of the laptop docking station to WiFi.
In Linux, interface binding is handled by the kernel module bonding. Fedora does not enable this feature by default, but it is included in the kernel-core package. This means that enabling interface binding requires only one command:
Sudo modprobe bonding
Please note that this will only take effect before you restart. To permanently enable interface binding, create a file called bonding.conf in the / etc/modules-load.d directory that contains only the word bonding.
Now that you have enabled binding, you can create a binding interface. First, you must get the name of the interface you want to bind. To list the available interfaces, run:
Sudo nmcli device status
You will see the following output:
DEVICE TYPE STATE CONNECTIONenp12s0u1 ethernet connected Wired connection 1tun0 tun connected tun0virbr0 bridge connected virbr0wlp2s0 wifi disconnected-p2p-dev-wlp2s0 wifi-p2p disconnected-enp0s31f6 ethernet unavailable-lo loopback unmanaged-virbr0-nic tun unmanaged--
In this example, there are two (wired) Ethernet interfaces available. Enp12s0u1 is on the laptop docking station, and you can know that it is connected through the STATE column. The other is enp0s31f6, which is the built-in port in the laptop. There is also a WiFi connection called wlp2s0. Enp12s0u1 and wlp2s0 are the two interfaces that we are interested in here. (please note that you don't need to know how to name network devices to read this article, but if you are interested, you can check the systemd.net-naming-scheme man page. )
The first step is to create a binding interface:
Sudo nmcli connection add type bond ifname bond0 con-name bond0
In this example, the binding interface is named bond0. Con-name bond0 sets the connection name to bond0. If you do this directly, you will have a connection called bond-bond0. You can also make the connection name more user-friendly, such as "Docking station bond" or "Ben".
The next step is to add the interface to the bound interface:
Sudo nmcli connection add type ethernet ifname enp12s0u1 master bond0 con-name bond-ethernetsudo nmcli connection add type wifi ifname wlp2s0 master bond0 ssid Cotton con-name bond-wifi
As shown above, the connection name is set to be more descriptive. Be sure to replace enp12s0u1 and wlp2s0 with the appropriate interface names on the system. For the WiFi interface, please replace my "Cotton" with your own network name (SSID). If your WiFi connection has a password (of course it will! You also need to add it to the configuration The following assumes that you use WPA2-PSK authentication
Sudo nmcli connection modify bond-wifi wifi-sec.key-mgmt wpa-psksudo nmcli connection edit bond-wif
The second command goes to the interactive editor where you can enter your password without recording it in the shell history. Enter the following to replace password with your actual password.
Set wifi-sec.psk passwordsavequit
Now you can start your binding interface and the secondary interface you created.
Sudo nmcli connection up bond0sudo nmcli connection up bond-ethernetsudo nmcli connection up bond-wifi
You should now be able to disconnect your wired or wireless connection without losing your network connection.
Warning: when using other WiFi networks
This configuration is effective when moving between specified WiFi networks, but when away from this network, the SSID used in the binding is not available. In theory, it is possible to add an interface for each WiFi connection used, but this does not seem to make sense. Instead, you can disable the binding interface:
Sudo nmcli connection down bond0
When you go back to the defined WiFi network, simply start the binding interface as described above.
Fine-tune your binding
By default, the binding interface uses the polling round-robin mode. This distributes the load evenly across the interface. However, if you have wired and wireless connections, you may want to prefer wired connections. Active-backup mode can achieve this function. You can specify the mode and home interface when you create the interface, or use this command later (the binding interface should be shut down):
Sudo nmcli connection modify bond0 + bond.options "mode=active-backup,primary=enp12s0u1"
Via: https://fedoramagazine.org/bond-wifi-and-ethernet-for-easier-networking-mobility/
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.