Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IP masqerading with a dynamique IP adresse ! 1

Status
Not open for further replies.

haux

Programmer
Apr 11, 2001
79
DZ
I know that, i can share an internet connection using Linux with IPCHAIN but with Static IP.
My probleme is who to do that if i connect by phone and the ISP give a differnet IP each time i connect ?

must i change the IP of the getway in my client PCs each connection ? (what a big problem !!!)

I use Red Hat 6.2 (kernel 2.2.15)

Thanks for all ;-)
 
Hi,



You can use ip masquerading (a specific type of network address transalation) and just specify the outbound interface. It should then work irrespective of whatever the IP is at any given time.



ipchains -A forward -i eth1 -s 172.16.16.0/24 -j MASQ



(where you set 'eth1' to be your external interface - might be ppp0 for example. The 172.16.16.0/24 is an example of the address range on you local lan.)



It's really that simple. You also need to activate packet forwarding by doing :



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



Rgds.



 
Thanks for reponse.

But i still haven't understand one thing.
Since i use a modem (ppp0), should i change the gatway IP in each client in my intranet after each connection to internet?.

Because i must tell the clients where (IP) to find the gatway.

Best regards
 
Hi,

try using the adress of your internet machine as gateway on your clients...

Regards
Thomas
 
Hi,

Yes, as stated above, you would set the client default gateway to the static lan address (probably eth0 interface) of the linux gateway box. You do <not> set the gateway as the IP of the ppp0 interface and you don't need to do any client changes if the ppp0 ip alters. The clients will just route packets to the gateway and the gateway handles everything transparently.

Regards
 
Yes i see now.
Bad question because bad comprehension....

Thanks ifincham, TSch
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top