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 > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "the configuration tutorial of dual network card host routing in Linux environment". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Environment:
Three directly connected computer hosts are shown in the figure
PC1PC2PC3
There are two network cards eth0 and eth2 on PC2, which are connected to PC3 and PC1 respectively.
-represents the network cable
Second, demand:
Configure PC2 in router mode to forward messages between PC1 and PC3
3. Methods:
After the three hosts are directly connected with the cross cable according to the requirements of the environment, assign the network segment to the three hosts and configure the IP address.
The network segment and IP address are assigned as follows:
Assign an IP gateway to the network segment where the hostname is located
PC1: 192.168.2.0/24 192.168.2.2/24 192.168.2.1
PC2: 192.168.2.0 PC2 24 192.168.2.1 Universe 24 'configuration of the network card connected to the PC1' eth2
192.168.1.0 Compact 24 192.168.1.1 Compact 24 'configuration of Network Card connected to PC3' eth0
PC3: 192.168.1.0/24 192.168.1.2/24 192.168.1.1
Configure the host IP address as shown in the table above. It is important to note that if you want PC2 to have the function of message forwarding, in PC2
Check whether the value in / proc/sys/net/ipv4/ip_forward is 1 on the
Command:
# more / proc/sys/net/ipv4/ip_forward
If the value is not 1 but 0, enter the following command:
# echo'1' > / proc/sys/net/ipv4/ip_forward
Turn on IP forwarding function
Other configurations in PC2:
To add a route to PC2, command:
# route add-net 192.168.1.0 netmask 255.255.255.0 dev eth0
# route add-net 192.168.2.0 netmask 255.255.255.0 dev eth2
Fourth, verification:
PC1:
Ping Gateway
# ping 192.168.2.1
# ping 192.168.1.1
Ping PC3:
# ping 192.168.1.2
PC3:
Ping Gateway
# ping 192.168.1.1
# ping 192.168.2.1
Pint PC1
# ping 192.168.2.2
Fifth, Bug debugging:
The reason for the error mainly lies in two places of PC2.
1. Check whether PC2 allows IP message forwarding (whether the value of / proc/sys/net/ipv4/ip_forward is 1)
two。 Whether the routing settings are correct (# route enter View)
This is the end of the tutorial on the configuration of dual network card host routing in Linux environment. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.