View previous topic :: View next topic |
Author |
Message |
ulmi n00b
Joined: 26 Nov 2006 Posts: 4
|
Posted: Sun Nov 26, 2006 11:13 pm Post subject: routes_eth0 documentation? [SOLVED] |
|
|
I'm trying to configure my NIC with the /etc/conf.d/net.eth0 script, but I couldn't find any documentation about the syntax the routes_eth0 variable expects. Perhaps I'm just missing something obvious.
The routes I would like to add:
route add -host 10.0.0.1 dev eth0
route add -host 10.0.0.2 dev eth0
route add default gw 10.0.0.1
I tried setting routes_eth0 to the following:
routes_eth0=( "-host 10.0.0.1 dev eth0" "-host 10.0.0.2 dev eth0" "default gw 10.0.0.1")
but I get a syntax error with the host-specific routes.
Last edited by ulmi on Mon Nov 27, 2006 7:35 pm; edited 1 time in total |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54785 Location: 56N 3W
|
Posted: Sun Nov 26, 2006 11:24 pm Post subject: |
|
|
ulmi,
Welcome to gentoo.
You will find what you are looking for in /etc/conf.d/net.example, its a fully documented net file. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
ulmi n00b
Joined: 26 Nov 2006 Posts: 4
|
Posted: Sun Nov 26, 2006 11:47 pm Post subject: |
|
|
the only thing I found in the net.example file concerning routes was the following:
Quote: |
# Here's how todo routing if you need it
#routes_eth0=(
# "default via 192.168.0.1" # IPv4 default route
# "10.0.0.0/8 via 192.168.0.1" # IPv4 subnet route
# "::/0" # IPv6 unicast
#)
|
this doesn't tell me how to set a Interface as Destination instead of a IP-Address.
I tried "10.0.0.1/32 via dev eth0" and "10.0.0.1/32 via eth0" but neither of it worked. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54785 Location: 56N 3W
|
Posted: Sun Nov 26, 2006 11:59 pm Post subject: |
|
|
ulmi,
Do not specify the interface. Its inferred from the That says everything that follows is reached using eth0.
I'm not sure why you want the host specific routes
Code: | routes_eth0=(
"default via 10.0.0.1"
) | sends all other packets to 10.0.0.1 as being the default to get to other networks.
You get a route associated with your own IP for your default subnet without asking for it.
From your original post Code: | route add -host 10.0.0.1 dev eth0
route add -host 10.0.0.2 dev eth0
route add default gw 10.0.0.1 | the -host route to 10.0.0.1 is redundant as its also your defualt gateway. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
ulmi n00b
Joined: 26 Nov 2006 Posts: 4
|
Posted: Mon Nov 27, 2006 12:29 am Post subject: |
|
|
NeddySeagoon,
My IP-Address is 10.0.0.2/32, which means I don't get a route associated with 10.0.0.1 automatically
(sorry for not stating that in my first post).
If I configure the routes manually it works just fine.
Output of route -n:
Code: |
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.1 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
10.0.0.2 0.0.0.0 255.255.255.255 UH 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 10.0.0.1 0.0.0.0 UG 0 0 0 eth0
|
Quote: |
Do not specify the interface. Its inferred from the
Code:
routes_eth0
That says everything that follows is reached using eth0
|
If I do not specify the Interface(routes_eth0="10.0.0.1/32") I get a 'SIOCADDRT: Invalid argument' Error-Message |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54785 Location: 56N 3W
|
Posted: Mon Nov 27, 2006 7:04 pm Post subject: |
|
|
ulmi,
I added in a static route to my existing setup, which is all static. Its the -host line below
Code: | config_eth_lan=(
"192.168.100.18/24 broadcast 192.168.100.255"
)
routes_eth_lan=(
"default via 192.168.100.1"
"-net 192.168.0.0/24 via 192.168.100.6"
"-host 10.0.0.1"
) | The message Code: | * Starting eth_lan
* Bringing up eth_lan
* 192.168.100.18/24 [ ok ]
* Adding routes
* default via 192.168.100.1 ... [ ok ]
* -net 192.168.0.0/24 via 192.168.100.6 ... [ ok ]
* -host 10.0.0.1 ... [ ok ] | looks good as does Code: | $ /sbin/route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.1 * 255.255.255.255 UH 0 0 0 eth_lan
192.168.100.0 * 255.255.255.0 U 0 0 0 eth_lan
192.168.101.0 * 255.255.255.0 U 0 0 0 eth_spare
192.168.0.0 192.168.100.6 255.255.255.0 UG 0 0 0 eth_lan
loopback * 255.0.0.0 U 0 0 0 lo
default Moriarty 0.0.0.0 UG 0 0 0 eth_lan |
Add your host based routes, one per line, using the syntax above. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
ulmi n00b
Joined: 26 Nov 2006 Posts: 4
|
Posted: Mon Nov 27, 2006 7:27 pm Post subject: |
|
|
Thanks a lot NeddySeagoon, that worked. |
|
Back to top |
|
|
|