Skip to main content

route_command

· 2 min read
Spark light

important

all

debian(linux)

ip route add 0/0 via 192.168.1.1 route add 10.2.100.0 mask 255.255.255.0 192.168.2.230 #/usr/sbin/ip -6 addr add '2402:4e00:1701:ea00:0:98f9:46b2:d3d3/64' dev eth0 #/usr/sbin/ip -6 route add default via 2402:4e00:1701:ea00::0 dev eth0

busybox(openwrt, alpine)

  • openwrt: iproute == ip route

iproute del local $IPV6ADDR dev eth0 iproute add local $IPV6ADDR dev eth0 route add -net 10.0.0.0/8 dev eth0.2 gw 192.168.2.6 route del default route delete -net 45.78.6.36 netmask 255.255.255.255 route add default gw 192.168.1.1 route add default gw 192.168.1.1 dev br-lan route add default dev wireguard

macosx

  • show netstat -nr
-n:(show ip or show name)
sudo route -n delete -net 0.0.0.0
sudo route -n add -net 0.0.0.0 192.168.1.1
sudo route -n add -net 0.0.0.0 192.168.123.198
sudo route -n add -net 10.2.100.0 192.168.2.230 255.255.255.0
sudo route -n delete -net 10.2.100.0

win

ipconfig /flushdns

others

ifconfig eth0 192.168.1.67/24 echo "nameserver 61.139.2.69" > /etc/resolv.conf