In some cases it might be necessary to add more routes to the virtual network interface. There are two ways to indicate which interface a packet should go to, one is to use the name of the interface itself, another way is to specify the (local) address that is assigned to that interface (local_address). The former way is unambiguous and therefore preferable, but not all platforms support this.
Adding routes to IPv4 subnets:
Linux | route add -net network_address netmask netmask interface
|
Linux iproute2 | ip route add network_address/ prefixlength dev interface
|
FreeBSD | route add network_address/ prefixlength local_address
|
OpenBSD | route add network_address/ prefixlength local_address
|
NetBSD | route add network_address/ prefixlength local_address
|
Solaris | route add network_address/ prefixlength local_address -interface
|
Darwin (Mac OS X) | route add network_address/ prefixlength -interface interface
|
Windows | netsh routing ip add persistentroute network_address netmask interface local_address
|
Adding routes to IPv6 subnets:
Linux | route add -A inet6 network_address/ prefixlength interface
|
Linux iproute2 | ip route add network_address/ prefixlength dev interface
|
FreeBSD | route add -inet6 network_address/ prefixlength local_address
|
OpenBSD | route add -inet6 network_address local_address -prefixlen prefixlength
|
NetBSD | route add -inet6 network_address local_address -prefixlen prefixlength
|
Solaris | route add -inet6 network_address/ prefixlength local_address -interface
|
Darwin (Mac OS X) | route add -inet6 network_address/ prefixlength -interface interface
|
Windows | netsh interface ipv6 add route network address/prefixlength interface
|