Правим /etc/network/interfaces
Содержимое будет приблизительно такого вида
root@ubuntu-server:~#tail /etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet dhcp #
В конец файла дописываем требуемы нам роутинги
post-up route add -net 10.0.0.0 netmask 255.0.0.0 gw 192.168.0.10 post-up route add -net 192.168.0.0 netmask 255.255.0.0 gw 192.168.0.192 ...
Как применить сетевые настройки без перезагрузки системы?
root@ubuntu-server:~# /etc/init.d/networking restart
Посмотреть текущие маршруты в системе можно командами ip route show
или просто route
root@ubuntu-server:~# route ? Usage: route [-nNvee] [-FC] [] List kernel routing tables route [-v] [-FC] {add|del|flush} ... Modify routing table for AF. route {-h|--help} [] Detailed usage syntax for specified AF. route {-V|--version} Display version/author and exit. -v, --verbose be verbose -n, --numeric don't resolve names -e, --extend display other/more information -F, --fib display Forwarding Information Base (default) -C, --cache display routing cache instead of FIB =Use '-A ' or '--'; default: inet List of possible address families (which support routing): inet (DARPA Internet) inet6 (IPv6) ax25 (AMPR AX.25) netrom (AMPR NET/ROM) ipx (Novell IPX) ddp (Appletalk DDP) x25 (CCITT X.25) root@ubuntu-server:~#