LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 08-05-2005, 04:45 AM   #1
Xing
Member
 
Registered: Aug 2003
Location: New Delhi, India
Distribution: RH 9, RH 8, RH 7.3,Slackware
Posts: 123

Rep: Reputation: 15
Internet Sharing : IP Masquerade


Dear All,

I have the following setup working ...

To ISP provider <-----eth1 <------Linux Box <--------eth0 <--------ethX <------ Anybox
------------------192.168.1.3--------------------172.16.56.201-----172.16.56.206-------------

both eth0 and eth1 are on Linux Box

By keeping gateway as 172.16.56.201 on anybox, i am able to ping 192.168.1.3 but i am not able to access internet.

Now will IP Masquerade work in this case as well? How to access internet from Anybox?
Internet is working on Linux Box.

Regards

xing

Last edited by Xing; 08-05-2005 at 04:54 AM.
 
Old 08-05-2005, 11:17 PM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Re: Internet Sharing : IP Masquerade

Quote:
Originally posted by Xing
Dear All,

I have the following setup working ...

To ISP provider <-----eth1 <------Linux Box <--------eth0 <--------ethX <------ Anybox
------------------192.168.1.3--------------------172.16.56.201-----172.16.56.206-------------

both eth0 and eth1 are on Linux Box

By keeping gateway as 172.16.56.201 on anybox, i am able to ping 192.168.1.3 but i am not able to access internet.

Now will IP Masquerade work in this case as well? How to access internet from Anybox?
Internet is working on Linux Box.

Regards

xing
first, you'll need to do SNAT or MASQUERADE on "Linux Box"... something like this example:
Code:
echo 0 > /proc/sys/net/ipv4/ip_forward
echo 1 > /proc/sys/net/ipv4/conf/all/rp_filter

iptables -F FORWARD
iptables -P FORWARD DROP

iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i eth0 -o eth1 -m state --state NEW -j ACCEPT

iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE

echo 1 > /proc/sys/net/ipv4/ip_forward
as for "Anybox", i'm not sure cuz i don't understand that part of your diagram...

in other words, i understand this part:
Quote:
To ISP provider <-----eth1 <------Linux Box <--------eth0
but i don't understand this part:
Quote:
<--------ethX <------ Anybox
------------------192.168.1.3--------------------172.16.56.201-----172.16.56.206-------------

Last edited by win32sux; 08-05-2005 at 11:22 PM.
 
Old 08-06-2005, 06:55 AM   #3
Xing
Member
 
Registered: Aug 2003
Location: New Delhi, India
Distribution: RH 9, RH 8, RH 7.3,Slackware
Posts: 123

Original Poster
Rep: Reputation: 15
Quote:
but i don't understand this part:
quote:
--------------------------------------------------------------------------------
<--------ethX <------ Anybox
------------------192.168.1.3--------------------172.16.56.201-----172.16.56.206-------------
it should be more clear this way

eth1 = 192.168.1.3
eth0 = 172.16.56.201
ethx = 172.16.56.206

Anybox is a windows machine with ethx as the LAN Card.

regards

xing
 
Old 08-06-2005, 04:57 PM   #4
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
so Anybox is a windows box with three NICs, right??

what's the IP of eth0 on Linux Box??


Last edited by win32sux; 08-06-2005 at 05:18 PM.
 
Old 08-09-2005, 01:25 AM   #5
Xing
Member
 
Registered: Aug 2003
Location: New Delhi, India
Distribution: RH 9, RH 8, RH 7.3,Slackware
Posts: 123

Original Poster
Rep: Reputation: 15
Dear win32sux,

if you look att he diagram; anybox, which is a windows machine has just one NIC card.. and linux box has two NIC cards..

eth0(172.16.x.x) and eth1(192.168.x.x) are NIC cards on linux box and anybox has a NIC card ethx (172.16.y.y)

i hope this makes things clear..

regards

xing
 
Old 08-09-2005, 01:52 AM   #6
roopunix
Member
 
Registered: Feb 2004
Location: Kathmandu
Distribution: Redhat/fedora/Suse [Wanna Drive With Debian]
Posts: 208

Rep: Reputation: 30
so are windows box now able to browse the internet or not??
 
Old 08-10-2005, 05:01 AM   #7
Xing
Member
 
Registered: Aug 2003
Location: New Delhi, India
Distribution: RH 9, RH 8, RH 7.3,Slackware
Posts: 123

Original Poster
Rep: Reputation: 15
No, the winboxes are not able to browse internet as of now
 
Old 08-10-2005, 07:14 AM   #8
roopunix
Member
 
Registered: Feb 2004
Location: Kathmandu
Distribution: Redhat/fedora/Suse [Wanna Drive With Debian]
Posts: 208

Rep: Reputation: 30
As i have uderestood understood you following diagram

To ISP provider <-----eth1 <------Linux Box <--------eth0 <--------ethX <------ Anybox
------------------192.168.1.3--------------------172.16.56.201-----172.16.56.206-------------

you should be doing this

iptables -t nat -A POSTROUTING -s 172.16.0.0/16 -o eth1 -j MASQUERADE

#vi /etc/sysctl.conf

# Controls IP packet forwarding
net.ipv4.ip_forward = 0

make it to 1 then save and exit

#/sbin/sysctl.conf -p
#service iptables save

now in the windows machine give the gateway 172.16.56.201
the dns section will be the same like other machines.If you don't know ask your ISP.
 
  


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
mandrake 10.1 sharing files and internet sharing xfiles_arram Linux - Networking 0 05-21-2005 02:22 PM
Internet Sharing Dimega Linux - Networking 6 09-28-2004 04:36 AM
masquerade problem (internet sharing) Pres Linux - Networking 4 04-27-2004 09:24 AM
Internet Browsing via IP MASQUERADE very slow on Windows clients digihall7 Linux - Networking 13 10-28-2003 05:14 AM
File sharing and internet sharing mullet Linux - Networking 1 10-14-2003 01:30 PM

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

All times are GMT -5. The time now is 10:20 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