LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 07-19-2005, 03:02 PM   #1
JustJD
LQ Newbie
 
Registered: Jun 2005
Posts: 4

Rep: Reputation: 0
Question Gateway Configuration


How do I edit the iptable? I have two Interfaces on the gateway - one that is connected to the Internet and one that is connected to the hub. The clients are also connected to the hub. I want the clients to make requests via the gateway - how do I set up IP Masquerade?
 
Old 07-19-2005, 03:22 PM   #2
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
if eth0 is facing the Internet and eth1 is facing the LAN, then this would do it:
Code:
iptables -P FORWARD DROP

iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

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

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
make sure you have forwarding enabled:
Code:
echo "1" > /proc/sys/net/ipv4/ip_forward
just my ...
 
Old 07-21-2005, 03:39 PM   #3
JustJD
LQ Newbie
 
Registered: Jun 2005
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks for the info - followed your instructions but I still no joy. eth0 is connected to the Internet - fine- when I try to enable eth1 I get the message "Determining IP information for eth1...." then nothing?
 
Old 07-21-2005, 04:04 PM   #4
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
Quote:
Originally posted by JustJD
Thanks for the info - followed your instructions but I still no joy. eth0 is connected to the Internet - fine- when I try to enable eth1 I get the message "Determining IP information for eth1...." then nothing?
well, my post assumed your interfaces were already configured...

sounds like your eth1 is trying to find a DHCP server... perhaps you should instead assign it a static ip address like 192.168.0.1 on subnet 255.255.255.0 for example??
 
Old 07-21-2005, 04:31 PM   #5
JustJD
LQ Newbie
 
Registered: Jun 2005
Posts: 4

Original Poster
Rep: Reputation: 0
If eth1 is connecting to the hub using the static IP address 192.168.0.1 will it then be listening for traffic? What address do the other clients use to request a connection from the gateway to the Internet?
Say: ifconfig says that the address of one client connected to the hub is 192.168.0.104, the next is 192.168.0.103, and the static address I assigned to gateway is 192.168.0.1, which is connect to the uplink jack of the hub.

Do the clients make requests to 192.168.0.1?
 
Old 07-21-2005, 05:30 PM   #6
win32sux
LQ Guru
 
Registered: Jul 2003
Location: Los Angeles
Distribution: Ubuntu
Posts: 9,870

Rep: Reputation: 380Reputation: 380Reputation: 380Reputation: 380
yes, the clients would need to have 192.168.0.1 configured as their gateway...
 
Old 07-22-2005, 01:47 AM   #7
<Ol>Origy
Member
 
Registered: Aug 2003
Location: Slovenia
Distribution: Arch, Debian, Embedded
Posts: 136

Rep: Reputation: 15
Also don't forget to provide the clients with the proper DNS server IPs (your ISP).
This will allow them to access websites by name e.g. www.google.com instead of 66.249.85.104

~Ol
 
  


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
a problem with debian box gateway configuration DRagonRage Debian 5 09-15-2005 07:30 AM
Atypical Gateway Configuration Centinul Linux - Networking 24 08-05-2005 05:10 PM
Configuration DHCP and Gateway on linux machine zowey Linux - Networking 4 04-03-2004 02:17 PM
internet gateway problems (iptables configuration) woranl Linux - Networking 11 08-27-2003 11:41 PM
two nic cards configuration for gateway red1526 Linux - Networking 3 03-06-2002 04:44 PM

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

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