ref: https://www.cyberciti.biz/faq/ip-route-add-network-command-for-linux-explained/
ip route add {NETWORK/MASK} via {GATEWAYIP}
ip route add {NETWORK/MASK} dev {DEVICE}
ip route add default {NETWORK/MASK} dev {DEVICE}
ip route add default {NETWORK/MASK} via {GATEWAYIP}
For example, if there are multiple vlan, we can force the route to use a particular interface
For example, if you want to access vlan 192.168.2.0/24, you can do:sudo ip route add 192.168.2.0/24 via 192.168.1.1 dev enp4s0
If you have another vlan 192.168.10.0/24 you want to access, you can do
sudo ip route add 192.168.10.0/24 via 192.168.1.1 dev enp4s0
No comments:
Post a Comment