LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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 03-20-2002, 04:53 AM   #1
juan.villamil
LQ Newbie
 
Registered: Mar 2002
Location: London
Posts: 2

Rep: Reputation: 0
masquerade question


I am reasonably new to linux and I am struggling…

I just installed Redhat 7.2..went through a painful experience of configuring the speedtouch usb modem to work on the BT adsl offering…so far so good…

Now I am trying to get my box to nat…I read the NAT faq…seems straight forward…

I can ping my inside interface and even my ppp interface…but that’s it…

Does anyone have any ideas…I would really appreciate any help….
 
Old 03-20-2002, 08:42 AM   #2
fatgod
Member
 
Registered: Mar 2002
Location: Edinburgh, Scotland
Distribution: Suse 7.2, Gentoo 1.4, Solaris 9
Posts: 661

Rep: Reputation: 30
You can execute this on the box that has the modem (server). I have read that this is not the best way to do it, but it will enable you to connect in the meantime. just change the xxx.xxx.xxx.xxx to the internal IP of the machine to be masq'd (or the client) You can use this to masq several machines too, just duplicate the command changing the IP.
'ipchains -A forward -i ppp0 -s xxx.xxx.xxx.xxx/0 -j MASQ'
 
Old 03-20-2002, 11:36 AM   #3
juan.villamil
LQ Newbie
 
Registered: Mar 2002
Location: London
Posts: 2

Original Poster
Rep: Reputation: 0
The FAQ describes iptables not ipchains…and they are not compatible with each other….

This is what I ended up with now....
 
Old 03-20-2002, 12:43 PM   #4
fatgod
Member
 
Registered: Mar 2002
Location: Edinburgh, Scotland
Distribution: Suse 7.2, Gentoo 1.4, Solaris 9
Posts: 661

Rep: Reputation: 30
iptables is the new version of ipchains, thats all. ipchains works for me just fine. Just use ipchains for now and you can investigate the use of iptables at your leisure The command listed above will happily masq any traffic going out to the internet from the IP address you specify. This works fine on my setup, I have a linux server that the alcatel adsl modem is connected to, and I dual boot the client machine with windoze and linux both of which can access the inet throught the server.
 
Old 03-20-2002, 05:08 PM   #5
bbenz3
Member
 
Registered: Feb 2002
Location: Orlando
Distribution: Whatever I feel like at the time I install.
Posts: 284

Rep: Reputation: 30
Here is how I did it using iptables on an ethernet setup:

# internal
LAN_IP="192.168.168.1"
LAN_IFACE="eth0"
LAN_SUB="192.168.168/24"

INET_IFACE1="eth1"
INET_IP1=`ifconfig $INET_IFACE1 | grep "inet addr:" | \awk -F: {'print $2'} | cut -d\ -f 1`

iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source $INET_IP1

echo 1 > /proc/sys/net/ipv4/ip_forward

# full access to eth0 nic
iptables -A INPUT -p ALL -i eth0 -s $LAN_SUB -j ACCEPT
iptables -A OUTPUT -p ALL -s $LAN_SUB -j ACCEPT
iptables -A FORWARD -i eth0 -d 0/0 -p all -j ACCEPT
iptables -t nat -A POSTROUTING -p all -d 0/0 -s 0/0 -j SNAT --to-source $INET_IP1

That is the basic setup. The rest of the script is the firewall setup. YOu will have to mod it some to make it work with your connection.
 
Old 03-21-2002, 05:39 AM   #6
fatgod
Member
 
Registered: Mar 2002
Location: Edinburgh, Scotland
Distribution: Suse 7.2, Gentoo 1.4, Solaris 9
Posts: 661

Rep: Reputation: 30
You will need to change the LAN addresses to match your machines, and it looks like bbenz3 is connecting with PPPoE, we connect with PPPoA so change eth1 to ppp0.
 
  


Reply



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
question about masquerade Tearless Linux - Networking 3 11-13-2003 02:25 PM
IP Masquerade question Gilion Linux - Networking 1 09-24-2003 11:10 AM
IP Masquerade qbik Slackware 3 09-11-2003 03:02 PM
IP Masquerade help armcfall Linux - Networking 6 06-24-2003 09:06 AM
About masquerade Nuts Linux - Networking 8 08-30-2002 09:56 AM

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

All times are GMT -5. The time now is 06:00 PM.

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