LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
LinkBack Search this Thread
Old 02-08-2005, 07:02 PM   #1
meadensi
LQ Newbie
 
Registered: Feb 2005
Posts: 18

Rep: Reputation: 0
Not forwarding packets


I have a linux laptop with two NICs which has worked as a firewall in the past. Now I’ve changed some settings (which were necessary) it no longer works. I’ve spent the whole day experimenting and so am forced to post. Ok, as much detail as possible…

Hardware: Toshiba Laptop 460CDT 32Mb Ram so no graphics only command-line
eth0: Belkin eth1:Netgear
Distro: Redhat 7.0

I am feeding a subnet off my brother’s home network and so can’t change some settings but his router to the Internet is 192.168.71.2

My machines were in the range of 192.168.144.201 to 192.168.144.206 but masqueraded into his network via the linux firewall with IP addresses 192.168.144.206 on my side and 192.168.71.198 on his. I have a selection of bash scripts which amend the ipchains configuration. Everything was fine.

1. Now, I want to run a web server and so cannot use NAT/IP masquerading anymore re Tsuji et al (2000) p. 176. It seems that we cannot hide the web server behind a masqueraded IP address.

2. So I decided to change my IP address range from 192.168.144.200/29 to 192.168.71/29 and now it doesn't work.

3. I have IP packeting forward set to true/yes/1 because I get
# cat /proc/sys/net/ipv4/ip_forward
1


4. My ipchains firewall is set to accept everything at the moment but obviously I will tighten it once I get some packets through.
# ipchains -L
Chain input (policy ACCEPT):
Chain forward (policy ACCEPT):
Chain output (policy ACCEPT):

5. The configuration file for the first NIC seems ok....
# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
IPADDR="192.168.71.198"
NETMASK="255.255.255.0"
ONBOOT="yes"
...other less relevant settings follow.

6. The configuration file for the second NIC ....
# cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE="eth1"
IPADDR="192.168.71.206"
NETMASK="255.255.255.248"
ONBOOT="yes"
...other less relevant settings follow.

7. The overall network config file....
# cat /etc/sysconfig/network
NETWORKING=yes
FORWARD_IPV4=yes
HOSTNAME="toshiba.foo.bar"
DOMAINNAME="foo.bar"
GATEWAY="192.168.71.2"
GATEWAYDEV="eth0"
...other less relevant settings follow.

8. Rebooting the network ...
# /etc/rc.d/init.d/network restart
Shutting down interface eth0 [OK]
Shutting down interface eth1 [OK]
Disabling IPv4 packet forwarding [OK]
Setting network parameters [OK] Note it does not say "Enabling IPv4 packet forwarding" !!!!!!!!
Bringing up interface lo [OK]
Bringing up interface eth0 [OK]
Bringing up interface eth1 [OK]

8. Using ifconfig....
# ifconfig
eth0 Link encap:Ethernet HWAddr 00:30:BD:11:49:51
inet addr:192.168.71.198 Bcast:192.168.71.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:59 errros:0 dropped:0 overruns:0 frame:0
TX packets:218 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
Interrupt:3 Base address:0x300

eth1 Link encap:Ethernet HWAddr 00:09:5B:1C:DB:4E
inet addr:192.168.71.206 Bcast:192.168.71.207 Mask:255.255.255.248
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:765 errros:0 dropped:0 overruns:0 frame:0
TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
Interrupt:5 Base address:0x340

lo Link encap:Local loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:3924 Metric:1
RX packets:95 errros:0 dropped:0 overruns:0 frame:0
TX packets:95 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0

9. Checking my routing table I get
# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.71.200 * 255.255.255.248 U 0 0 0 eth1
192.168.71.0 * 255.255.255.0 U 0 0 0 eth0
127.0.0.0 * 255.0.0.0 U 0 0 0 lo
default 192.168.71.2 0.0.0.0 UG 0 0 0 eth0
I realise that some people may object to the overlap implied in this table but I think it should still work. After all, the table is sorted and scanning by Genmask and so if the laptop receives a packet destined for my little subnet 192.168.71.200/255.255.255.248 then it will match the top entry and pump it through to NIC eth1. Only if it fails the first line does it get to the second line and pump out through NIC eth0.
Besides I have tried reconfiguring the second line with an address of 192.168.71.0/255.255.255.128 which would eliminate the overlap to see if that helps but sadly no luck.

10. Some defined hostnames....
# cat /etc/hosts
127.0.0.1 toshiba localhost.localdomain localhost
192.168.71.198 belkin.toshiba.foo.bar belkin0
192.168.71.206 netgear1.toshiba.foo.bar
192.168.71.201 compaq.foo.bar

11. Other stuff probably not relevant...
# cat /etc/host.conf
order hosts, bind

12. So, from a windows box within my little subnet, compaq.foo.bar 192.168.71.201, I try pinging my brother's internet router
> ping 192.168.71.2
...Request timed out...
Fails

13. Again from the box in my subnet I see if I can reach the NIC in the laptop on my subnet's side ...
> ping 192.168.71.206
Reply from 192.168.71.206...
Success as you would expect.

14. Again from the box in my subnet I see if I can reach the NIC in the laptop on the far side ...
> ping 192.168.71.198
Reply from 192.168.71.206...
Success as I didn't expect. It manages to traverse the first NIC to the second NIC but never gets any further! Very strange in my humble opinion.

15. Repeating step 12 but this time running a sniffer
# tcpdump -n >dump
> ping 192.168.71.2
...Request timed out....
#cat dump
00:49:22 eth1 B arp who-has 192.168.71.2 tell 192.168.71.201
00:49:23 eth1 B arp who-has 192.168.71.2 tell 192.168.71.201
00:49:24 eth1 B arp who-has 192.168.71.2 tell 192.168.71.201
00:49:26 eth1 B arp who-has 192.168.71.2 tell 192.168.71.201

I think that's a pretty exhaustive report of the settings, do I get a prize?
Any help is prize enough people.

Regards,
Meadensi


Bibliography:
Setting Up a Linux Internet Server (2000) by Hidenori Tsuji & Takashi Watnabe (Coriolis).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Forwarding packets with Iptables DrunkenDisciple Linux - Software 2 07-24-2005 11:00 PM
forwarding packets to multiple computers for different ports laxy_m Linux - Networking 7 11-11-2004 08:15 AM
Problem about forwarding packets in kernel Lite Linux - Networking 0 07-20-2004 09:33 PM
Forwarding ACK Packets snufferz Linux - Newbie 0 05-12-2004 02:10 AM
pardon the silly question: forwarding packets FROM certain ports? FallenHero Linux - Networking 7 06-18-2002 07:46 AM


All times are GMT -5. The time now is 01:40 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration