IPv4
配置IP
ip addr add ip/掩码 dev 指定接口
eg:
IP addr add 10.10.10.10/24 dev eth2
配置路由
ip route add 目的IP或目的网段/掩码 via 下一跳
eg :
ip route add 20.20.02.1 via 10.10.10.1
ip route add 20.20.20.0/24 via 10.10.10.1
删除路由
IP route delete 20.20.20.0/24 via 10.10.10.1
IPv6
配置IP
IP -6 addr add 5000::1/24 dev eth2
配置路由
IP -6 route add 5000::/24 via 4000::1
删除路由
IP -6 route delete 5000::/24 via 4000::1
查看路由
route -6
route
查看IP
ifconfig eth2
ifconfig