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 08-04-2005, 02:49 AM   #1
kermitthefrog91
LQ Newbie
 
Registered: Apr 2005
Location: Brussels, Belgium
Distribution: Gentoo
Posts: 17

Rep: Reputation: 0
NAT forwarding


Hey

I have two computeres here in my room, but only one wireless card

We have a wireless network and the base station is downstairs and handles the internet. I want get the computer here in my room wihtout a wireless card to connect to the whole network..... Can i do it with NAT forwarding in iptables?

on the box with both connections
wlan0
inet 192.168.1.3

eth0
inet 192.168.0.2

on the other one
eth0
inet 192.168.0.1

ive got a crossover cable running between them...

is this possible to do?
how do i do it?

thanks
 
Old 08-04-2005, 03:04 AM   #2
roopunix
Member
 
Registered: Feb 2004
Location: Kathmandu
Distribution: Redhat/fedora/Suse [Wanna Drive With Debian]
Posts: 208

Rep: Reputation: 30
do nat on the box with both connection

#/sbin/iptables -t nat -A POSTROUTING -s 192.168.0.1 -o wlan0 -j MASQUERADE
#service iptables save

then give the gateway 192.168.0.2 in the other box.

DNS address remains the same.

then do ip forwarding
#cd /etc
#vi sysctl.conf
net.ipv4.ip_forward = 0
make it to 1 and save and exit
then
#/sbin/sysctl -p



Last edited by roopunix; 08-04-2005 at 03:08 AM.
 
Old 08-04-2005, 03:10 AM   #3
TigerOC
Senior Member
 
Registered: Jan 2003
Location: Devon, UK
Distribution: Debian Etc/kernel 2.6.18-4K7
Posts: 2,380

Rep: Reputation: 49
Install and setup ip-masquerading on the box with the wireless lan connection and then tell the cabled box to use the wireless box as the gateway. Some more info on iptables configuration here .
 
Old 08-04-2005, 03:12 AM   #4
kermitthefrog91
LQ Newbie
 
Registered: Apr 2005
Location: Brussels, Belgium
Distribution: Gentoo
Posts: 17

Original Poster
Rep: Reputation: 0
worked great thanks
 
Old 08-04-2005, 03:26 AM   #5
Nathanael
Member
 
Registered: May 2004
Location: Karlsruhe, Germany
Distribution: debian, gentoo, os x (darwin), ubuntu
Posts: 940

Rep: Reputation: 32
you could do bridging... that means that both your wlan0 and your eth0 devices are 'bridged' to br0, br0 gets the ip address assigne, and you set ip frowarding ('echo 1 > /proc/sys/net/ipv4/ip_forward')
then your 2nd (not wireless enabled) computer gets the ip address assigend from your accesspoint, or other router, and your first pc acts like a switch (in this case like a wireless accesspoint).
you can still use iptables to secure the entire setup.
 
  


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
NAT and Port Forwarding aq_mishu Linux - Networking 2 09-16-2005 07:58 AM
NAT forwarding FTP ports Ossar Linux - Networking 4 03-14-2005 12:07 PM
Port Forwarding without NAT on an old Kernel linuxpyro Linux - Networking 0 06-02-2004 12:31 PM
NAT Port forwarding problems! nidputerguy Linux - Networking 4 01-31-2004 10:29 AM
bizarre nat forwarding problem ignorantliwong Linux - Networking 1 09-04-2003 10:12 PM


All times are GMT -5. The time now is 02:33 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration