De Help Desk punt NL
Kennisbank
De Helpdesk > De Helpdesk > Kennisbank

Route add in Linux

Oplossing

Route manipulates the kernel's IP routing tables. Its primary use is to set up static routes to specific hosts or networks via an interface after it has been configured with the ifconfig program.

When the add or del options are used, route modifies the routing tables. Without these options, route displays the current contents of the routing tables.

Add static route using "route add":
# route add -net 192.168.100.0 netmask 255.255.255.0 gw 192.168.1.1 dev eth0

If you want persistent static route, you need to edit /etc/sysconfig/network-scripts/route-eth0 file to define static routes for eth0 interface.

# vim /etc/sysconfig/network-scripts/route-eth0
GATEWAY0=192.168.1.1
NETMASK0=255.255.255.0
ADDRESS0=192.168.100.0

Save and close the file. Restart networking:
# service network restart

Verify new routing table by,

#ip route

# route -n

# netstat -rn

 
Was dit artikel bruikbaar? ja / nee
Gerelateerde artikelen How TO install/Configure APF (Advanced Policy Firewall) Firewall
Hoe integreer je Linux in een bestaand netwerk?
ifconfig
Geen netwerk in Centos 6 na installatie
Configureren netwerk statisch IP-adres Redhat, CentOs en Fedora
Vind verborgen apparaten op je netwerk met arp-scan
DDOS via hping3 linux
Artikel details
Artikel ID: 186
Categorie: Netwerk
Zoekwoorden route, linux, add, toevoegen, ip, table, netmask, sysconfig, static, eth0, interface, netstat,
Datum toegevoegd: 7-Jul-2014 20:29:30
Aantal bekeken: 569
Beoordeling (Stemmen): Artikel beoordeeld 3.3/5.0 (24)

 
« Ga terug