The configuration data forwarding, can pass 1, the route forwarding namely uses the router realizes;
2, using NAT forwarding;
To put it simply:
The information in the routing table is just the next place in the router where the packet is specified. Does not change the address information of the packet itself. That is, it just "change the road, the destination is unchanged";
The address translation is to convert the address of the packet to a web-enabled IP address, so that the host can be authenticated to the Internet. That is, "replace the destination";
Setting and removing IP addresses
To set an IP address, you can use the following IP commands:
# ip addr Add 192.168.0.193/24 dev Wlan0
Please note that the IP address must have a suffix, such as/24. This usage is used to display the subnet mask used in the no-class intra-domain routing (CIDR). In this example, the subnet mask is 255.255.255.0.
After setting the IP address, you need to see if it is already in effect
#ip Addr Show Wlan0
Delete the IP address, just need del Replace add
#ip addr del 192.168.0.193/24 Dev Wlan0
Routing Table Related:
The parameters of the routing object for the IP command can also help you view the routing data in the network and set up the routing table. The first entry is the default routing entry, and you can change it at will.
1. List the routing table entries:
#ip Route Show
1[Email protected]:~# IP Route2 defaultVia222.132.16.49Dev Br03 defaultVia222.132.16.49Dev br0 Metric - 4 10.0.0.0/ -Dev eth1 proto kernel scope link src10.0.0.50 5 10.22.0.0/ -Dev br0 proto kernel scope link src10.22.0.1 6 10.128.0.0/ -Dev br0 proto kernel scope link src10.128.0.3 7 10.128.0.0/ -Dev br0 proto kernel scope link src10.128.0.1 8 192.168.122.0/ -Dev virbr0 proto kernel scope link src192.168.122.1 9 222.132.16.0/ -Dev br0 proto kernel scope link src222.132.16.50
In this example, there are several routing entries. This result shows that several devices are connected by different network interfaces. They include WiFi, Ethernet, and a point-to-point connection
2. Suppose now that you have an IP address, you need to know where the routing packets come from. You can use the following routing options: Lists the interfaces used by the route, and so on:
Get 101.80. 4.77 101.80. 4.77 222.132. 16.49 Dev br0 222.132. 16.50
3. Change the default route
#ip route add default via 192.168.1.1 #default via
4. Display the network statistic data
#ip-S link
1[Email protected]:~# ip-s Link2 1: Lo: <LOOPBACK,UP,LOWER_UP> MTU65536qdisc noqueue State UNKNOWN3Link/loopbackxx:xx:xx:xx:xx:xxBrdxx:xx:xx:xx:xx:xx4 rx:bytes packets Errors dropped overrun Mcast5 78835338 773177 0 0 0 0 6 tx:bytes packets errors dropped carrier Collsns7 78835338 773177 0 0 0 0 8 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> MTU theQdisc MQ Master Ovs-system State up Qlen +9Link/etherxx: -: 9e:9c: $: theBRD FF:FF:FF:FF:FF:FFTen rx:bytes packets Errors dropped overrun Mcast One 1229283210 9618898 0 0 0 1300950 A tx:bytes packets errors dropped carrier Collsns - 14610128653 14780439 0 0 0 0
When you need to get information about a particular network interface, add the option LS after the network interface name. Using multiple options-S will give you more detailed information about this particular interface. This is especially useful when troubleshooting network connections.
#ip-S link ls eth0
5. Activating and stopping the network interface
#ip Link Set eth1 down
#ip Link set eth0 up
Equivalent:
#ifconfig eht1 Down
#ifconfig eth1 up
Linux under IP command usage