????Linux·????route????
???????????? ???????[ 2014/12/31 15:16:39 ] ????????Linux ??????
?????? Linux ???·???
???????????? route ???????? Linux ???·????
????# route
????Destination Gateway Genmask Flags Metric Ref Use Iface
????192.168.0.0 * 255.255.255.0 U 0 0 0 eth0
????169.254.0.0 * 255.255.0.0 U 0 0 0 eth0
????default 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
????route ?????????????
????????? ???
????Destination ??????λ???????
????Gateway ????????”*” ?????????????????????????????·??
????Genmask ????????
????Flags ???
?????Щ??????????£?
????U — ·???????
????H — ????????????
????N — ???????????
????G — ·?????????
????R — ??????·??????????
????D — ??·??????????????
????M — ??·????????????
????! — ???·??
????Metric ·????????????????????????????linux ??????????????
????Ref ·?????????????linux ??????????????
????Use ??·????·????????????? ??
????Iface ??·??????????????? ??
????***********************************************************************************************************************************
????3 ??·??????
????????·??
????????·????·?????????????IP?????????????·??????????·???Flags????H?????磬???????????У????????????IP???192.168.1.1??·????????IP????10.0.0.10????????
????Destination Gateway Genmask Flags Metric Ref Use Iface
????----------- ------- ------- ----- ------ --- --- -----
????10.0.0.10 192.168.1.1 255.255.255.255 UH 0 0 0 eth0
????????·??
????????·??????????????????????硣????·???Flags????N?????磬???????????У????????????????????192.19.12????????????IP????192.168.1.1??·??????
????Destination Gateway Genmask Flags Metric Ref Use Iface
????----------- ------- ------- ----- ----- --- --- -----
????192.19.12 192.168.1.1 255.255.255.0 UN 0 0 0 eth0
???????·??
????????????????·????в?????????????IP?????????·????????????????????·?????????????????·???Flags????G?????磬???????????У????·????IP????192.168.1.1??·??????
????Destination Gateway Genmask Flags Metric Ref Use Iface
????----------- ------- ------- ----- ------ --- --- -----
????default 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
????***********************************************************************************************************************************
???????t??·??
????route ????
???????ú??·?????????? route ???????????·?????????????
????# route [add|del] [-net|-host] target [netmask Nm] [gw Gw] [[dev] If]
???????У?
????add : ??????·?????
????del : ??????·?????
????-net : ??????????????
????-host : ??????????????
????target : ????????????
????netmask : ???????????????
????gw : ·????????????????
????dev : ?·?????????????
????route ??????t???
??????????????·??
????# route add -host 192.168.1.2 dev eth0:0
????# route add -host 10.20.30.148 gw 10.20.30.40
?????????????·??
????# route add -net 10.20.30.40 netmask 255.255.255.248 eth0
????# route add -net 10.20.30.48 netmask 255.255.255.248 gw 10.20.30.41
????# route add -net 192.168.1.0/24 eth1
??????????·??
????# route add default gw 192.168.1.1
???????·??
????# route del -host 192.168.1.2 dev eth0:0
????# route del -host 10.20.30.148 gw 10.20.30.40
????# route del -net 10.20.30.40 netmask 255.255.255.248 eth0
????# route del -net 10.20.30.48 netmask 255.255.255.248 gw 10.20.30.41
????# route del -net 192.168.1.0/24 eth1
????# route del default gw 192.168.1.1
????***********************************************************************************************************************************
???????e????
?????? CentOS ??????????????????????·???????????????????????????????????? Linux??·????????????????????????????????????ú????????????????? sysctl ??????磺????? Linux?????????????????????????μ????
????# sysctl -w net.ipv4.ip_forward=1
??????????????????????????????????′?????????????Ч?????????′???????????????Ч??
????????????????д?????????/etc/sysctl.conf??
????# vi /etc/sysctl.conf
????net.ipv4.ip_forward = 1
???????????????????μ???????????????????????
????# sysctl net.ipv4.ip_forward
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11