路由命令

2025-02-22  本文已影响0人  DD_Dog

ip route add

ip route add default via 10.21.65.50 dev seth_lte0 table 200
这个命令 添加了一条默认路由,将所有没有明确目标的流量发送到 网关 10.21.65.50。
使用 seth_lte0 接口 来传输这些数据。
这条路由被添加到 table 200 路由表 中,而不是默认的 main 路由表。

解释:

ip addr show seth_lte0

检查seth_lte0接口状态

ip link set dev seth_lte0 up

启动接口seth_lte0

root@sp9820e_1h10ll:/etc # ip link set dev seth_lte0 up
root@sp9820e_1h10ll:/etc # ip addr show seth_lte0
5: seth_lte0: <NOARP,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/[530] 8a:3a:44:32:20:77 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::f2a3:3e94:8ae0:ae17/64 scope link
       valid_lft forever preferred_lft forever
root@sp9820e_1h10ll:/etc #

ip route show table 200

查看路由表

1|root@sp9820e_1h10ll:/etc # ip route show table 200
default via 10.10.145.139 dev seth_lte1
root@sp9820e_1h10ll:/etc #

ip rule show

查看所有路由规则

root@sp9820e_1h10ll:/etc # ip rule show
0:      from all lookup local
32766:  from all lookup main
32767:  from all lookup default
root@sp9820e_1h10ll:/etc #

tcpdump抓网络包

adb shell tcpdump -i any -p -s0 -w /sdcard/capture2.pcap
adb pull /sdcard/capture.pcap .
上一篇 下一篇

猜你喜欢

热点阅读