Basic Routing / ifconfig question

Basic Routing / ifconfig question

Post by Shane Koste » Sun, 14 May 2000 04:00:00



I'm have to set up a Redhat 6.2 machine to connect to the internet
through a T1 line. This machine will be a firewall/router, so it has two
network cards. The eth0 interface is the external (i.e. Internet)
interface.  I have been allocated a range of IP address to use. I was
told that I could use 222.111.51.200 - 222.111.51.207 with a netmask of
255.255.255.248 as my IP address range. The address 222.111.51.201
should be the T1 router (i.e. default gateway).

My question is, what should be my ifconfig and route statements if I
want to use 222.111.51.204 as the external ip address of my firewall
machine?

I've actually got it to work when I did the following:

ifconfig eth0 222.111.51.201 netmask 255.255.255.0 broadcast
222.111.51.207 up
route add -net 222.111.51.200 netmask 255.255.255.0 eth0
route add default gw 222.111.51.201 eth0

But when I did this, my routing table didn't seem to be correct. I
always thought it should have an entry that looked like:

DEST             GATEWAY   NETMASK           IFACE
222.111.51.201   0.0.0.0   255.255.255.248   eth0

but it didn't.  Am I mistaken on this?

Thanks for any advice you can give me.

--

 
 
 

Basic Routing / ifconfig question

Post by Robie Bas » Mon, 15 May 2000 04:00:00


On Sat, 13 May 2000 16:57:06 GMT, Shane Koster said:

Quote:>I'm have to set up a Redhat 6.2 machine to connect to the internet
>through a T1 line. This machine will be a firewall/router, so it has two
>network cards. The eth0 interface is the external (i.e. Internet)
>interface.  I have been allocated a range of IP address to use. I was
>told that I could use 222.111.51.200 - 222.111.51.207 with a netmask of
>255.255.255.248 as my IP address range. The address 222.111.51.201
>should be the T1 router (i.e. default gateway).

>My question is, what should be my ifconfig and route statements if I
>want to use 222.111.51.204 as the external ip address of my firewall
>machine?

>I've actually got it to work when I did the following:

>ifconfig eth0 222.111.51.201 netmask 255.255.255.0 broadcast
>222.111.51.207 up
>route add -net 222.111.51.200 netmask 255.255.255.0 eth0

Is this a typo? Shouldn't it be eth1, otherwise the router will
send to your other computers the wrong way...

Quote:>route add default gw 222.111.51.201 eth0

...because your router is on eth0.

Quote:

>But when I did this, my routing table didn't seem to be correct. I
>always thought it should have an entry that looked like:

>DEST             GATEWAY   NETMASK           IFACE
>222.111.51.201   0.0.0.0   255.255.255.248   eth0

>but it didn't.  Am I mistaken on this?

>Thanks for any advice you can give me.

Hmmm.

I'm not sure that would quite work. You need to tell it that
222.111.51.200/29 is on eth1, and that 222.111.51.201 specifically
is on eth0, otherwise it won't route straight. The first two
route commands should be:
        route add -net 222.111.51.200 netmask 255.255.255.248 dev eth1
        route add -host 222.111.51.201 dev eth0
except that I'm not sure which way round that should be, or even
if it matters (anyone?). Try both :-)

Then add the gateway:
        route add default gw 222.111.51.201

HTH, Robie.
--

 
 
 

Basic Routing / ifconfig question

Post by Daniel Kiracof » Mon, 15 May 2000 04:00:00



> I'm have to set up a Redhat 6.2 machine to connect to the internet
> through a T1 line. This machine will be a firewall/router, so it has two
> network cards. The eth0 interface is the external (i.e. Internet)
> interface.  I have been allocated a range of IP address to use. I was
> told that I could use 222.111.51.200 - 222.111.51.207 with a netmask of
> 255.255.255.248 as my IP address range. The address 222.111.51.201
> should be the T1 router (i.e. default gateway).

> My question is, what should be my ifconfig and route statements if I
> want to use 222.111.51.204 as the external ip address of my firewall
> machine?

> I've actually got it to work when I did the following:

> ifconfig eth0 222.111.51.201 netmask 255.255.255.0 broadcast
> 222.111.51.207 up

 Well, now this certainly isn't right.  You said that 201 was the
address of your T1 router.  So why are you giving that address to your
linux box?  Shouldn't you use:

ifconfig eth0 222.111.51.204 netmask 255.255.255.248 broadcast
222.111.52.207

Quote:> route add -net 222.111.51.200 netmask 255.255.255.0 eth0

 I'm not sure if you really need to do this.  I believe that recent
versions of ifconfig automtically add a route to the local network.
However, you have /24 netmask here.  Did you really want to go to all
those hosts, or just your assigned range?

Quote:> route add default gw 222.111.51.201 eth0

 Now this looks right, except that the eth0 is spurious.  Just tell it
the address, and it will figure out the appropriate interface by itself.

Quote:> But when I did this, my routing table didn't seem to be correct. I
> always thought it should have an entry that looked like:

> DEST             GATEWAY   NETMASK           IFACE
> 222.111.51.201   0.0.0.0   255.255.255.248   eth0

> but it didn't.  Am I mistaken on this?

 No, it should look more like this

Dest            Gateway         Genmask         Iface
default         222.111.51.201  255.255.255.255 eth0
222.111.51.200  *               255.255.255.248 eth0

 and then the routes for your loopback, eth1, etc.

--
/* Daniel */

Webpage: http://www.cis.ohio-state.edu/~kiracofe

"Fear is only afraid of the absence of itself" - Mediocrates

 
 
 

1. ifconfig and route questions

Why is it that when I use ifconfig to set my ip address it resets to the
old ip address after a reboot? I set up my ip address with ifconfig and
added my router with route add default gw xxx.xxx.xxx.xxx and the
network didn't work. I rebooted only to find that the ip address had
reverted to the old one.

2. RS6000 xdbx

3. route insists on using dns, ifconfig on modifying the routing table... please help me!

4. posix msg. queues (Sol 9). Memory-based or disk-based ?

5. Solaris ifconfig and route questions

6. Anyone running tpqic02 with SLS1.03?

7. adding a route in aix - no basic question!

8. Problem installing Ghostscript 2.2 under X

9. Basic routing question

10. Basic ISDN PPP Routing Question?

11. basic routing concept question

12. Basic network / routing question

13. Basic 'route' question