LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   routing table help needed (http://www.linuxquestions.org/questions/linux-networking-3/routing-table-help-needed-786729/)

IanVaughan 02-03-2010 12:20 PM

routing table help needed
 
Ok, Im running Devil"Linux 2.6.31.7-grsec #1 SMP i686 pentium4 i386 GNU/Linux" (v1.4RC2). Booting from CDROM, loading the "etc" config from USB.

Its being setup to be a gateway from the main company network, to my own subnet network.
I have 2 NICs :-
eth0 : connected to my internal/local subnet
eth1 : connected to the companies main network (ie External)

I cant figure out how to route IP traffic to and from the subnet?
ie, Get (ssh etc) to eg IP:192.168.109.10 from 172.24.x.x, and vise-versa.
Manually, it would be a "route add ???"?
On the gateway machine?
Automatically it would be adding "ROUTE=???" into "/etc/sysconfig/nic/ifcfg-eth0"?

My company states that the subnet IP's will be forwarded to the gateway IP, so assuming that they are, what and how do I setup the routing?

* The Gateway primary interface IP address is : 172.24.150.50
* Allocated address for the gateway : 172.24.150.50/24
* Our default gateway is : 172.24.150.1
* We have been allocated the IP address range 192.168.109.0/27
(which means that we can use 192.168.109.0 to 192.168.109.31)


Here are some files and debug :-
"/etc/sysconfig/nic/ifcfg-eth0"
Code:

#NIC Card (internal subnet)
DEVICE=eth0
ONBOOT=yes
MODULE="autoselect"
DHCP=server
IP="192.168.109.1"
NETMASK="255.255.255.0"
BROADCAST="192.168.109.31"

"/etc/sysconfig/nic/ifcfg-eth1"
Code:

#onBoard NIC - External network to company network
DEVICE=eth1
ONBOOT=yes
MODULE=autoselect
DHCP=no
IP=172.24.150.50
NETMASK=255.255.255.0
BROADCAST=172.24.150.255
ROUTE="$ROUTE default/0.0.0.0:172.24.150.1"

Code:

root@172.24.150.50 # ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0E:0C:64:5E:0D
        inet addr:192.168.109.1  Bcast:192.168.109.31  Mask:255.255.255.0
        UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
        RX packets:444 errors:0 dropped:0 overruns:0 frame:0
        TX packets:538 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:100
        RX bytes:104999 (102.5 KiB)  TX bytes:50525 (49.3 KiB)

eth1      Link encap:Ethernet  HWaddr 00:11:43:B9:E2:21
        inet addr:172.24.150.50  Bcast:172.24.150.255  Mask:255.255.255.0
        UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
        RX packets:808 errors:0 dropped:0 overruns:0 frame:0
        TX packets:373 errors:0 dropped:0 overruns:0 carrier:0
        collisions:0 txqueuelen:1000
        RX bytes:92684 (90.5 KiB)  TX bytes:98230 (95.9 KiB)
        Interrupt:16


root@172.24.150.50 # route
Kernel IP routing table
Destination    Gateway        Genmask        Flags Metric Ref    Use Iface
172.24.150.0    *              255.255.255.0  U    0      0        0 eth1
192.168.109.0  *              255.255.255.0  U    0      0        0 eth0
default        172.24.150.1    0.0.0.0        UG    0      0        0 eth1

Windows Box on the Company network (ie not on my subnet)
Code:

H:\>ipconfig /all

Windows IP Configuration

      Host Name . . . . . . . . . . . . : <removed>
      Primary Dns Suffix  . . . . . . . : <removed>.co.uk
      Node Type . . . . . . . . . . . . : Hybrid
      IP Routing Enabled. . . . . . . . : No
      WINS Proxy Enabled. . . . . . . . : No
      DNS Suffix Search List. . . . . . : <removed>.co.uk
                                          <removed>.co.uk.
                                          <removed>.co.uk
                                          co.uk

Ethernet adapter Local Area Connection:

      Connection-specific DNS Suffix  . : <removed>.co.uk.
      Description . . . . . . . . . . . : Marvell Yukon 88E8057 PCI-E Gigabit
      Physical Address. . . . . . . . . : 00-01-6C-49-<removed>
      Dhcp Enabled. . . . . . . . . . . : Yes
      Autoconfiguration Enabled . . . . : Yes
      IP Address. . . . . . . . . . . . : 172.24.150.51
      Subnet Mask . . . . . . . . . . . : 255.255.255.0
      Default Gateway . . . . . . . . . : 172.24.150.1
      DHCP Server . . . . . . . . . . . : 172.24.10.13
      DNS Servers . . . . . . . . . . . : 172.21.101.1
                                          172.27.101.1
      Primary WINS Server . . . . . . . : 172.21.100.108
      Secondary WINS Server . . . . . . : 172.24.10.14
      Lease Obtained. . . . . . . . . . : 03 February 2010 14:19:15
      Lease Expires . . . . . . . . . . : 04 February 2010 14:19:15


H:\>route print
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x2 ...00 01 6c 49      ...... Marvell Yukon 88E8057 PCI-E Gigabit
===========================================================================
===========================================================================
Active Routes:
Network Destination        Netmask          Gateway      Interface  Metric
        0.0.0.0          0.0.0.0    172.24.150.1  172.24.150.51      10
      127.0.0.0        255.0.0.0        127.0.0.1      127.0.0.1      1
    172.24.150.0    255.255.255.0    172.24.150.51  172.24.150.51      10
  172.24.150.51  255.255.255.255        127.0.0.1      127.0.0.1      10
  172.24.255.255  255.255.255.255    172.24.150.51  172.24.150.51      10
  192.168.109.1  255.255.255.255    172.24.150.50  172.24.150.51      1
      224.0.0.0        240.0.0.0    172.24.150.51  172.24.150.51      10
 255.255.255.255  255.255.255.255    172.24.150.51  172.24.150.51      1
Default Gateway:      172.24.150.1
===========================================================================
Persistent Routes:
 None

I can ping 192.168.107.2 from 192.168.107.1 and visa-versa.



root@hostname:~ # cat /proc/sys/net/ipv4/ip_forward
1

Firewall is ok I believe :-

root@hostname:~ # iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination


Many thanks to anyone who even reads this, but even more to any answers! Ian

cardy 02-04-2010 07:32 AM

There are a few things you can do.

Firstly your broadcast address is wrong on eth0

Quote:

DEVICE=eth0
ONBOOT=yes
MODULE="autoselect"
DHCP=server
IP="192.168.109.1"
NETMASK="255.255.255.0"
BROADCAST="192.168.109.31"
Should be

Quote:

DEVICE=eth0
ONBOOT=yes
MODULE="autoselect"
DHCP=server
IP="192.168.109.1"
NETMASK="255.255.255.0"
BROADCAST="192.168.109.255"
Secondly As your gateway machine is on both networks. Have you tried pinging machines on both of the networks from that machine ?

i.e. from your gateway can you ping another machine on the 192.168.109.0/24 network and can you ping a machine on the 172.24.150.0/24 network.

This would at least establish you have connectivity on both networks.

Lee

IanVaughan 02-05-2010 02:54 AM

Code:

BROADCAST="192.168.109.255"
I dont think your right with that!
As my subnet only extends to 31, therefore the last IP must be my local Bcast
Code:

BROADCAST="192.168.109.31"

cardy 02-05-2010 03:48 AM

If your using a 255.255.255.0 subnet mask then the broadcast IP will be 255

As shown below, if the network mask is 255.255.255.0 the broadcast is 192.168.109.255

Quote:

$ ipcalculator 192.168.109.0 255.255.255.0
Address: 192.168.109.0 11000000.10101000.01101101. 00000000
Netmask: 255.255.255.0 = 24 11111111.11111111.11111111. 00000000
Wildcard: 0.0.0.255 00000000.00000000.00000000. 11111111
=>
Network: 192.168.109.0/24 11000000.10101000.01101101. 00000000
HostMin: 192.168.109.1 11000000.10101000.01101101. 00000001
HostMax: 192.168.109.254 11000000.10101000.01101101. 11111110
Broadcast: 192.168.109.255 11000000.10101000.01101101. 11111111
Hosts/Net: 254 Class C, Private Internet
If your broadcast should be .31 then you should have the following setup where your subnet mask is 255.255.255.224

Quote:

$ ipcalculator 192.168.109.0 255.255.255.224
Address: 192.168.109.0 11000000.10101000.01101101.000 00000
Netmask: 255.255.255.224 = 27 11111111.11111111.11111111.111 00000
Wildcard: 0.0.0.31 00000000.00000000.00000000.000 11111
=>
Network: 192.168.109.0/27 11000000.10101000.01101101.000 00000
HostMin: 192.168.109.1 11000000.10101000.01101101.000 00001
HostMax: 192.168.109.30 11000000.10101000.01101101.000 11110
Broadcast: 192.168.109.31 11000000.10101000.01101101.000 11111
Hosts/Net: 30 Class C, Private Internet

IanVaughan 02-06-2010 10:06 AM

You are right with this one, my Netmask is/should be : 255.255.255.224

I have solved the problem, not by changing Netmask/Bcast tho, but by the dhcpd.conf file not having the router=true flag set.

I am at home now, I'll doc exactly the setting on monday!


All times are GMT -5. The time now is 03:12 AM.