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