LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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
  Search this Thread
Old 09-03-2004, 07:19 PM   #1
jsaxton86
LQ Newbie
 
Registered: Jun 2004
Location: Minneapolis, MN, USA
Distribution: Debian (etch)
Posts: 12

Rep: Reputation: 0
IP Masquerading problem.


I just tried to setup a box running debian 3.0 r2 (kernel 2.2.20) to perform IP Masquerading. I used the following ruleset (mostly taken from a howto at TLDP)

Code:
#!/bin/sh

echo -e "\n\nLoading simple rc.firewall-2.2 : version $FWVER..\n"

IPCHAINS=/sbin/ipchains
DEPMOD=/sbin/depmod
MODPROBE=/sbin/modprobe

EXTIF="eth0"
INTIF="eth1"
echo "   External Interface:  $EXTIF"
echo "   Internal Interface:  $INTIF"

INTLAN="192.168.1.0/24"
echo -e "   Internal Interface:  $INTLAN\n"

echo "   loading required IPMASQ kernel modules.."

$DEPMOD -a

echo -en "   Loading modules: "

echo -en "FTP, "
$MODPROBE ip_masq_ftp

echo -en "RealAudio, "
$MODPROBE ip_masq_raudio
echo -en "Irc, "
$MODPROBE ip_masq_irc

echo ".  Done loading modules."

echo "   enabling forwarding.."
echo "1" > /proc/sys/net/ipv4/ip_forward

echo "   enabling AlwaysDefrag.."
echo "1" > /proc/sys/net/ipv4/ip_always_defrag

echo "   clearing any existing rules and setting default policy.."
$IPCHAINS -P input ACCEPT
$IPCHAINS -P output ACCEPT
$IPCHAINS -P forward REJECT
$IPCHAINS -F input
$IPCHAINS -F output
$IPCHAINS -F forward

echo "   setting default timers.."
$IPCHAINS -M -S 7200 10 160

$IPCHAINS -A input -j ACCEPT -i $EXTIF -s 0/0 67 -d 0/0 68 -p udp

echo "   enabling IPMASQ functionality on $EXTIF"
$IPCHAINS -P forward DENY
$IPCHAINS -A forward -i $EXTIF -s $INTLAN -j MASQ

echo -e "\nrc.firewall-2.2 v$FWVER done.\n"
When I run the script, the output is as follows:

Code:
DebianSever:~# /etc/rc.firewall

Loading simple rc.firewall-2.2 : version 1.22..

External Interface : eth0
Internal Interface : eth1
Loading required IPMASQ modules
Loading modules: FTP, IRC, . Done loading modules.
enabling forwarding..
enabling AlwaysDefrag..
clearing any existing rules and setting default policy
/etc/rc.firewall: -P: command not found
setting default timers..
enabling IPMASQ functionality on eth0

rc.firewall2.2 v1.22 done.
I could not ping anything on the internal interface. I tried pinging the IPMASQ box from my desktop and that also failed. I ran ifconfig to see if all my interfaces were working.

Code:
DebianServer:~#ifconfig -a

eth0  Link encap:Ethernet HWaddr 00:60:97:13:32:E6
  inet addr:192.168.1.105 Bcast:192.168.1.255
Mask:255.255.255.0
  UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
  RX packets:6 errors:0 dropped:0 overruns:0 frame:0
  TX packets:26 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:100
  RX bytes:1113 (1.0KiB) TX bytes:3143 (3.0 KiB)
  Interrupt:10 Base address:0X300

eth1  Link encap:Ethernet HWaddr 00:30:BD:2E:BF:E8
  BROADCAST MULTICAST MTU:1500 Metric:1
  RX packets:0 errors:0 dropped:0 overruns:0 frame:0
  TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:100
  RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
  Interrupt:9 Base address:0X3000

lo  Link encap:Local Loopback
  inet addr:127.0.0.1 Mask:255.0.0.0
  UP LOOBACK RUNNING MTU:3924 Metric:1
  RX packets:8 errors:0 dropped:0 overruns:0 frame:0
  TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:0
  RX bytes:560 (560.0 b) TX bytes:560 (560.0 b)

#I don't know what this is or how it got here
#It is there before I run the script as well
tunl0  Link encap:IPIP Tunnel HWaddr
  NOARP MTU:1480 Metric:1
  RX packets:0 errors:0 dropped:0 overruns:0 frame:0
  TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
  collisions:0 txqueuelen:0
  RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
As you can see, eth1 has no IP address. This is fixed by adding "auto eth1" to the /etc/network/interfaces file, but then my internet connection stops working. Any ideas on why this happens?

My /etc/network/interfaces file, for good measure:
Code:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)

#The loopback interface
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
iface eth1 inet static
  address 192.168.1.142
  netmask 255.255.255.0
  network 192.168.1.0
  broadcast 192.168.1.255

I would like to have this section of my network look like this :
router->eth0->eth1->switch->clients

I think my main problem is with eth1. Any help is greatly appriciated.
 
Old 09-03-2004, 07:55 PM   #2
guzzi
Member
 
Registered: Jun 2004
Location: Lawrence, KS
Distribution: Slackware
Posts: 313

Rep: Reputation: 40
ipchains

hello jsaxton86

I am also new to ipchains, but found info on how to do what you are looking for on the net.

google "Internet Connection Sharing Using IP Masquerading" there is a page authored by "munk" that gave me all I needed to make it happen.

Good Luck.
 
Old 09-03-2004, 08:28 PM   #3
bruno buys
Senior Member
 
Registered: Sep 2003
Location: Rio
Distribution: Debian
Posts: 1,513

Rep: Reputation: 46
Isn't this line indicating that you don't have either rc.firewall setup or any ipchains modules missing?
/etc/rc.firewall: -P: command not found
Besides this, I can't see any more problems...
 
Old 09-03-2004, 09:45 PM   #4
jsaxton86
LQ Newbie
 
Registered: Jun 2004
Location: Minneapolis, MN, USA
Distribution: Debian (etch)
Posts: 12

Original Poster
Rep: Reputation: 0
My problem was that both eth0 and eth1 were on the same subnet. I'm an idiot. Thank you all for your patience.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Masquerading problem eqxro Linux - Networking 0 01-14-2005 05:01 PM
IP Masquerading problem cijunet Slackware 1 04-04-2003 06:42 PM
IP Masquerading problem!!! bkmesenbrink Linux - Newbie 1 08-28-2002 03:29 PM
IP MAsquerading /Routing Problem krpotdar Linux - Networking 0 09-27-2001 06:36 AM
*REALLY* strange problem with ip masquerading 10e999 Linux - Networking 1 04-14-2001 10:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:53 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration