Difference between revisions of "Configure static routes in debian"
From Notes_Wiki
(Created page with "=Configure static routes in debian= To configure static routes in debian edit file '<tt>/etc/network/interfaces</tt>' and use <pre> up route add -net 192.168.2.0 netmask 255...") |
m |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Main Page|Home]] > [[Debian]] > [[Configure static routes in debian]] | |||
To configure static routes in debian edit file '<tt>/etc/network/interfaces</tt>' and use | To configure static routes in debian edit file '<tt>/etc/network/interfaces</tt>' and use | ||
Line 35: | Line 35: | ||
gateway 10.4.8.2 | gateway 10.4.8.2 | ||
</pre> | </pre> | ||
For DHCP based addressing use: '<tt>iface <interface-name> inet dhcp</tt>'. For example: | |||
<pre> | |||
auto eth1 | |||
iface eth1 inet dhcp | |||
</pre> | |||
[[Main Page|Home]] > [[Debian]] > [[Configure static routes in debian]] |
Latest revision as of 06:51, 31 March 2022
Home > Debian > Configure static routes in debian
To configure static routes in debian edit file '/etc/network/interfaces' and use
up route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.2.1 down route del -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.2.1
Sample file that uses same technique is:
auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 10.4.7.2 netmask 255.255.255.0 # gateway 10.4.7.1 up route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.4.7.1 down route del -net 10.0.0.0 netmask 255.0.0.0 gw 10.4.7.1 up route add -net 172.16.0.0 netmask 255.240.0.0 gw 10.4.7.1 down route del -net 172.16.0.0 netmask 255.240.0.0 gw 10.4.7.1 up route add -net 192.168.0.0 netmask 255.255.0.0 gw 10.4.7.1 down route del -net 192.168.0.0 netmask 255.255.0.0 gw 10.4.7.1 auto eth1 iface eth1 inet static address 10.4.8.54 netmask 255.255.255.0 gateway 10.4.8.2
For DHCP based addressing use: 'iface <interface-name> inet dhcp'. For example:
auto eth1 iface eth1 inet dhcp