You are not logged in.
Hello
Im kinda newbie here. My PC is running Arch Linux. The PC is member of two networks. So I need to find a way to add two IPs and several static routes on every network
For example
I want to add the 192.168.1.2 and 10.140.6.90 as IPs and 10.0.0.0/8 gw 10.140.6.1 as a static route
Can you tell me how to do that?
Thanks a lot
Offline
sure. Just add them to your rc.conf.
Are they separate NICs, or one NIC with multiple IPs?
"Be conservative in what you send; be liberal in what you accept." -- Postel's Law
"tacos" -- Cactus' Law
"t̥͍͎̪̪͗a̴̻̩͈͚ͨc̠o̩̙͈ͫͅs͙͎̙͊ ͔͇̫̜t͎̳̀a̜̞̗ͩc̗͍͚o̲̯̿s̖̣̤̙͌ ̖̜̈ț̰̫͓ạ̪͖̳c̲͎͕̰̯̃̈o͉ͅs̪ͪ ̜̻̖̜͕" -- -̖͚̫̙̓-̺̠͇ͤ̃ ̜̪̜ͯZ͔̗̭̞ͪA̝͈̙͖̩L͉̠̺͓G̙̞̦͖O̳̗͍
Offline
There is on the same NIC with multiple IPs and static routes
this is my current rc.conf conserning network
lo="lo 127.0.0.1"
eth0="eth0 192.168.2.7 netmask 255.255.0.0 broadcast 192.168.2.255"
gateway="default gw 192.168.2.1"
ROUTES=(gateway)
So how should I add the second IP and the static route?
Last edited by Hwoarang (2007-08-24 11:49:37)
Offline
I don't know if you have two NICs or one NIC but you can write a script or put your commands in rc.local script.
If you have one NIC you can use the following commands:
ifconfig eth0 192.168.1.2 netmask 255.255.255.0
ifconfig eth0:1 10.140.6.90 netmask 255.255.255.0
To Add a static route:
route add -net 10.0.0.0 netmask 255.0.0.0 gw 10.140.6.1
To Add a default route
route add default gw ip.address.of.gateway
If your have two NICs, the command is slightly different:
ifconfig eth0 192.168.1.2 netmask 255.255.255.0
ifconfig eth1 10.140.6.90 netmask 255.255.255.0
and the static routes are added the same.
Cheers.
Offline
Thank you very much
One last question. Is there a way to add them on rc.conf file instead of creating a script? Thanks
Offline
Hi Mate,
it is quite easy to put these commands in the rc.conf script because this script just uses the ifconfig and route command.
Here is what you need to do:
lo="lo 127.0.0.1"
eth0="eth0 192.168.1.2 netmask 255.255.255.0 broadcast 192.168.1.255"
eth1="eth0:1 10.140.6.90 netmask 255.255.255.0 broadcast 10.140.6.255"
INTERFACES=(lo eth0 eth1)
#TO add the static route and the default gateway:
static="-net 10.0.0.0 netmask 255.0.0.0 gw 10.140.6.1"
gateway="default gw 192.168.1.1"
ROUTES=(gateway static)
Hope this can help you.
Cheers.
Offline
Thanks mate for the help. Now works perfect .
Offline