Linux gateway setup experiment-Linux Enterprise Application-Linux server application information. For details, refer to the following section. Environment:
2 linux: redhat 9
1 XP Server
Experiment Process
One linux server with two NICs
Eth0 192.168.0.1 connected to the vswitch and the Intranet
Eth1 192.168.0.100 connects to the modem through adsl dialing
The route content is
[Root @ dbpi ppp] # route-n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
202.103.29.218 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 202.103.29.218 0.0.0.0 UG 0 0 0 ppp0
Another linux Nic
Eth0 192.168.0.111 gateway is set to 192.168.0.1
View route information
[Root @ server1/] # route-n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
The default route point is 0.1.
Start forwarding on this machine
[Root @ server1/] # echo 1>/proc/sys/net/ipv4/ip_forward
In the past, the XP Client directed to 0.1 and now enabled forwarding on 0.111. You can point the XP gateway to 0.111.
Tracking on XP, when pointing to 0.111, the information is as follows:
C: \ Documents ents and Settings \ Administrator> tracert 202.103.24.68
Tracing route to ns.wuhan.net.cn [202.103.24.68]
Over a maximum of 30 hops:
1 <1 MS <1 MS <1 MS 192.168.0.111
2 <1 MS <1 MS <1 MS 192.168.0.100
3 *** Request timed out.
4 22 MS 21 MS 21 MS 221.232.250.9
...
8 22 MS 21 MS 22 MS ns.wuhan.net.cn [202.103.24.68]
The original information pointing to 0.1 is as follows:
C: \ Documents ents and Settings \ Administrator> tracert 202.103.24.68
Tracing route to ns.wuhan.net.cn [202.103.24.68]
Over a maximum of 30 hops:
1 <1 MS <1 MS <1 MS 192.168.0.100
2 *** Request timed out.
3 21 MS 20 MS 21 MS 221.232.250.9
...
7 21 MS 22 MS 21 MS ns.wuhan.net.cn [202.103.24.68]
This hop can now be 0.111 more.
Add a network ip address to 111 of machines
Eth0: 0 192.168.1.112
The route information of 111 is as follows:
[Root @ server1/] # route-n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 192.168.0.1 0.0.0.0 UG 1 0 0 eth0
The XP gateway is set to 0.111, Which is 1.112 of the other subnet that cannot be pinged.
You need to enable forwarding again
Echo 1>/proc/sys/net/ipv4/ip_forward
In this way, after setting the gateway to 0.111, XP can both access the Internet and access another subnet.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service