Jump to content

Assigning host names to eth0 and eth1 & Route info


n9nu
 Share

Recommended Posts

Hello

 

I have what most would consider a pretty basic system and would like to get a few tips on assigning variables to each of the 2 NIC's I have in this Mandriva Box.

 

This box is connected directly to the 'Inet' via a fiber connection and acts as a FQDN http and FTP server for testing purposes and at times an 'on by request' FTP server. My domain name associated with this box is: fsx-planet.info . That NIC is eth1. The 2nd NIC is assigned 192.168.0.2 (local LAN) via NIC 2 (eth0). I want to access the LAN via eth0 to connect to my FreeNAS box and other machines on that subnet (192.168.0.x). The address of 192.168.0.1 is my Smoothwall box which in-turn feeds to my HP Gigabit managed switch. At this time I do NOT have this machine (the FQDN) behind the smoothwall box via port forwarding. I just want to access the LAN via eth0 (192.168.0.2).

 

My understanding is that I can have only 1 (one) gateway assigned to my box. Right now that gateway is setup to access the INET via my WISP. Now....I have been assigning the eth0 NIC the address of 192.168.0.2 as stated above WITH the gateway field filled in with 192.168.0.1 (the smoothwall box). This I understand is NOT the right way to do it...as I am getting substantial LAG because I have both NIC's assigned separate gateways. I was told I need to assign a 'static route' from the LAN NIC (eth0) to the smoothwall box address so I can properly access the LAN. I do not know where to enter the appropriate information (the route) within the /etc/xxx scripts.

 

My problem or question at this point is: How is the traffic I want to tx/rx via the LAN side able to 'know' to use the correct (eth0) LAN NIC ?? This is were I was told I needed to assign a 'route' to point to the 192.168.0.1 smoothwall box.

 

I have the host 'fsx-planet.info' assigned to the INET NIC (eth1) and the host 'internal.fsx-planet.info' assigned to the LAN NIC (eth0). Both entries get overwritten with 127.0.0.1 each time I reboot. I would like to 'statically' assign those host names to each of the NIC's in a way that they don't get over-written by 'drakhost' which is the Mandriva utility that automatically assigns that info upon start-up.

 

Can I edit say..../etc/sysconfig/network-scripts/ifcfg-eth0 and eth1 to include host info so it 'sticks' each time.

 

I just received an email suggesting I try using 'iptoute2' to allow for multiple gateways on one machine. It seems this is possible, but will wait for more input

 

Tim

 

 

Yeah...I probably made it confusing with all that ;)

Edited by n9nu
Link to comment
Share on other sites

You don't need multiple gateways.

 

If all your internal machines, freenas etc are all on the same network 192.168.0.x, then you just have the gateway on your machine set to the internet as it was originally. The machine will know that all machines from subnet 192.168.0.x are via eth0 and so it will be able to connect. If it cannot, then you either have a firewall on the other machines, or a problem with that link.

 

The only reason why you would need another route is if you had multiple ethernet segments on your internal LAN. For example, the machine has 192.168.0.x, and your other servers somewhere else have 192.168.10.x for example. Then you would not create a default route via eth0, because you can't really have two, but you would do this:

 

route add -net 192.168.10.0/24 gw 192.168.0.x

 

where the gateway 192.168.0.x is either a router on your LAN that your main server can see, or machine that is acting as a router between the two segments. There are some other complicated ways for routing, but you don't even need the one I've listed as an example here.

 

So, remove the additional default route you have added, and leave it pointing to the internet, access will work on the internal LAN, and if not, then you have a problem elsewhere because all your LAN machines are in the same subnet, and so don't need a default route because they are all connected to the same switch.

Link to comment
Share on other sites

If you want to handle multiple hostnames on the same machine, then the most convenient way is creating virtual network interfaces. Each virtual NIC can handle one hostname.

Sorry to say that I can't give any solid tip for Mandriva- I am comfortable with it only using Debian, CentOS and ArchLinux.

Link to comment
Share on other sites

Yep Ian is correct ;) (except for one little thing)

 

if you had another network on your lan you would not route via a gateway but via device.

 

ip route add 192.168.10.0/24 via eth1

*Note: not sure how to do this with route command .. haven't used route for years :D

 

which is why it "just works" out of the box.

 

The linux kernel loads the ethernet interface with a network attached to it, and sends a route via device command when the interface comes up.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...