Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Multiple Networks Howto ...
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
ckoeber
Apprentice
Apprentice


Joined: 21 May 2007
Posts: 156

PostPosted: Thu Jun 17, 2010 7:35 pm    Post subject: Multiple Networks Howto ... Reply with quote

Hello,

I am sure this is simple but I can't figure this out. I added a network card to an existing Gentoo installation to have two in total. ETH1 is my new network card which is a Gigabit connection and ETH0 is my old network card with just an 100 Mbit connection.

I would like for the new network card (ETH1) to connect to a 10.10.50.X (class C) network which accesses out local LAN and the old network card (ETH0) to connect to a 10.10.60.x (class C) network which is a wireless network that does not communicate with the 10.10.50.X network. This network also has internet access, if that is important.

I am not sure what to do. Right now both interfaces get DHCP but I cannot ping either card or get network access.

Any help is appreciated.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54254
Location: 56N 3W

PostPosted: Thu Jun 17, 2010 8:29 pm    Post subject: Reply with quote

ckoeber,

As you use DHCP on both subnets, your system will be confused.

If you look in the output of the route command, you will see you have two defualt routes, which is a bad thing.
You need to set up routing for the non default interface manually.

post the output of
Code:
route -n
for more specific help
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
ckoeber
Apprentice
Apprentice


Joined: 21 May 2007
Posts: 156

PostPosted: Thu Jun 17, 2010 8:43 pm    Post subject: Reply with quote

NeddySeagoon wrote:
ckoeber,

As you use DHCP on both subnets, your system will be confused.

If you look in the output of the route command, you will see you have two defualt routes, which is a bad thing.
You need to set up routing for the non default interface manually.

post the output of
Code:
route -n
for more specific help


Thanks for the help. Here is the output of route -n

Code:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.10.50.0      0.0.0.0         255.255.255.0   U     1      0        0 eth1
10.10.60.0      0.0.0.0         255.255.255.0   U     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.10.60.1      0.0.0.0         UG    0      0        0 eth0
0.0.0.0         10.10.50.1      0.0.0.0         UG    1      0        0 eth1


I don't know which route should be the default or what should be changed since I would like for this system to connect to both networks AND for other computers on both networks to be able to connect to this system.

Thanks again for everything.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54254
Location: 56N 3W

PostPosted: Thu Jun 17, 2010 9:14 pm    Post subject: Reply with quote

ckoeber,

You probably want your default route to point towards the next hop to the internet, or you won't be able to reach the internet at all. Therouting table you posted should work as the only default rout that will be used in the one on eth0.

When the kernel has a packet to route, it matches its destination IP against each rule in turn, when a match is found, the packet is sent, as 0.0.0.0 matches all packets, any packet that gets to the first 0.0.0.0 is sent over eth0.

As you use DHCP, its a matter of chance which default route is set up first ... it depends on DHCP server response times.
Hence you need to only allow the right default route, or set it statically in the net file.

Communication between eth0 and eth1 depends on Packet Forwarding being enabled in the kernel and turned on in /proc.
Its off by default, which is what you want.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
ckoeber
Apprentice
Apprentice


Joined: 21 May 2007
Posts: 156

PostPosted: Thu Jun 17, 2010 9:23 pm    Post subject: Reply with quote

NeddySeagoon wrote:
ckoeber,

You probably want your default route to point towards the next hop to the internet, or you won't be able to reach the internet at all. Therouting table you posted should work as the only default rout that will be used in the one on eth0.

When the kernel has a packet to route, it matches its destination IP against each rule in turn, when a match is found, the packet is sent, as 0.0.0.0 matches all packets, any packet that gets to the first 0.0.0.0 is sent over eth0.

As you use DHCP, its a matter of chance which default route is set up first ... it depends on DHCP server response times.
Hence you need to only allow the right default route, or set it statically in the net file.

Communication between eth0 and eth1 depends on Packet Forwarding being enabled in the kernel and turned on in /proc.
Its off by default, which is what you want.


I see. So, since ETH1 is my faster interface then I want that to be my default interface for most traffic. So, based on what you mentioned here should my /etc/conf.d/net file look like this?? :

Code:

config_eth0=( "10.10.60.3 netmask 255.255.255.0 brd 10.10.60.255" )
config_eth1=( "dhcp" )
dhcpcd_eth1="-N"
routes_eth1=( "default via 10.10.50.1" )


I have two questions:

  • Will any server software/connections work on ETH0 with the above configuration?
  • And, related, is a route for the 10.10.60.X network needed for server related traffic to work on that network?


Thanks.
Back to top
View user's profile Send private message
ckoeber
Apprentice
Apprentice


Joined: 21 May 2007
Posts: 156

PostPosted: Fri Jun 18, 2010 5:21 pm    Post subject: Reply with quote

OK, I made the changes but still no luck. The connections to the server on both interfaces are still sporadic and unreliable.

Here is my current /etc/conf.d/net file:

Code:
# This blank configuration will automatically use DHCP for any net.*
# scripts in /etc/init.d.  To create a more complete configuration,
# please review /etc/conf.d/net.example and save your configuration
# in /etc/conf.d/net (this file :]!).
config_eth1=( "dhcp" )
dhcpcd_eth1="-N"
routes_eth1=( "10.10.50.0/24 via 10.10.50.1"
         "10.10.1.0/24 via 10.10.50.1"
         "10.10.10.0/24 via 10.10.50.1"
         "10.10.20.0/24 via 10.10.50.1"
         "10.10.30.0/24 via 10.10.50.1"
)
config_eth0=( "10.10.60.3 netmask 255.255.255.0 brd 10.10.60.255" )
routes_eth0=( "10.10.60.0/24 via 10.10.60.1" )


And here are my current routes:

Code:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.10.20.0      10.10.50.1      255.255.255.0   UG    0      0        0 eth1
10.10.50.0      10.10.50.1      255.255.255.0   UG    0      0        0 eth1
10.10.50.0      0.0.0.0         255.255.255.0   U     0      0        0 eth1
10.10.1.0       10.10.50.1      255.255.255.0   UG    0      0        0 eth1
10.10.30.0      10.10.50.1      255.255.255.0   UG    0      0        0 eth1
10.10.60.0      10.10.60.1      255.255.255.0   UG    0      0        0 eth0
10.10.60.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
10.10.10.0      10.10.50.1      255.255.255.0   UG    0      0        0 eth1
127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo
0.0.0.0         10.10.50.1      0.0.0.0         UG    0      0        0 eth1


Anything else I need to do or change?

Thank you for your time.
Back to top
View user's profile Send private message
fancyladd
n00b
n00b


Joined: 28 Jun 2010
Posts: 1

PostPosted: Mon Jun 28, 2010 2:25 am    Post subject: Reply with quote

I'm not entirely sure what you are trying to do. Do you want a host from the 10.10.50.x network to be able to communicate with a host on the 10.10.60.x network? If so then NeddySeagoon is right and you need to enable packet forwarding on your Gentoo machine. Also the following routes in your routing table seem wrong to me:

10.10.50.0 10.10.50.1 255.255.255.0 UG 0 0 0 eth1

and

10.10.60.0 10.10.60.1 255.255.255.0 UG 0 0 0 eth0

If the Gentoo box has two interfaces, one in 10.10.50.x and the other in 10.10.60.x then you shouldn't add a route that sends all traffic for those two networks to another host (this is what your routing table is doing right now). For example, if you try and ping 10.10.50.2 from your Gentoo box it will send that packet to 10.10.50.1 which is probably not what you want. To fix this you should clean up /etc/conf.d/net. You can remove "10.10.60.0/24 via 10.10.60.1" and "10.10.50.0/24 via 10.10.50.1" for sure. This might solve your problem; however I'm not really sure what your problem is because you didn't explain how you tested this. Also what is 10.10.50.1 and 10.10.60.1? Are these two routers? Do you want your Gentoo box to be acting as a router between the two networks? If so then you will probably have to add some routes on the other hosts on both sides of each networks, or else use your Gentoo box as their default gateway. Perhaps you can include a little diagram so we can have a full understanding of your networks.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum