Linux route command practice, linuxroute
Configure the route table:
Step 1:
Sudo route add-net 172.30.6.0 netmask limit 255.0 eth0
After the command is executed, run the route-n command to view the information as follows:
172.30.6.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
This step enables communication between the LAN, but cannot communicate with the Internet through the vro 172.30.6.1
Parameter Parsing in the command line:
Add: Indicates adding route information.
-Net: indicates the network number following the network number. In this example, the network number is 172.30.6.0.
Netmask: indicates the subnet mask, followed by 255.255.255.0.
Eth0: indicates which device to set
Step 2:
Sudo route add default gw 172.30.6.1 eth0
After execution, you can use route-n to view the information as follows:
0.0.0.0 172.30.6.1 0.0.0.0 UG 0 0 0 eth0
This step enables the local machine to communicate with the Internet through the vro17172.30.6.1
Now you can access the Internet !!! (If you have any questions, please reply)