LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking > Linux - Wireless Networking
User Name
Password
Linux - Wireless Networking This forum is for the discussion of wireless networking in Linux.

Notices



Reply
 
Search this Thread
Old 06-01-2005, 11:32 PM   #1
DJOtaku
Member
 
Registered: Oct 2004
Location: USA
Distribution: Fedora 20; Arch; Kubuntu; Debian
Posts: 711

Rep: Reputation: 31
Can my linux computer be a router AND a regular computer?


I've had to switch to a location where my internet connection is provided only by wireless. Instead of buying two wireless cards (or usb wireless) can I just connect the wireless adapter to the Linux computer, connect the linux computer to a wired router, and connect another computer to the router to share the internet connection? I know this can be done when the Linux computer is just a router, but can it work and still function as a regular Linux PC?

If it can be done, would you be able to point me in the direction of an explanation? So far I was mostly able to find stuff relating to having the computer simply function as a router.
 
Old 06-02-2005, 03:05 AM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
As far as configuring the NAT for internet sharing, it shouldn't be any different then if you were doing the same for two NIC interfaces. The name of the interface may be different, wlan0 instead of eth0. If you got the wireless communicating with the internet service, the hardest work may be done. If FC3 has a configuration program for internet sharing, try that first.
 
Old 06-02-2005, 12:27 PM   #3
DavidPhillips
Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,155

Rep: Reputation: 56
Set the machine up as a nat router. Then just use it normally.

The howto's that show you how to setup a router are the correct ones to use.

Basically all you need to do is enable ipforwarding and ip masquerade.


This should be found in the network configuration gui if your using that. If not then it's a matter of setting ip_forward to 1 and entering the ip masquerade iptables command and do `service iptables save`


don't forget to set this at every boot..


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

Very basic rule would look like this...

/sbin/iptables -t nat -A POSTROUTING -o <Interface> -j MASQUERADE


In your case the output interface would be the wireless device

Last edited by DavidPhillips; 06-02-2005 at 12:42 PM.
 
Old 06-04-2005, 09:29 PM   #4
DJOtaku
Member
 
Registered: Oct 2004
Location: USA
Distribution: Fedora 20; Arch; Kubuntu; Debian
Posts: 711

Original Poster
Rep: Reputation: 31
so if I do

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

(if eth1 is the one I'm using for wireless)

Then I just plug my winbox into the linbox through the NICs, right?

What else do I need to type and how often do I need to type it?

Thanks a bunch!
 
Old 06-09-2005, 08:22 AM   #5
DavidPhillips
Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,155

Rep: Reputation: 56
This is required..

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


You can do this after a reboot to check it..


cat /proc/sys/net/ipv4/ip_forward

If you see a 1 then it's set.

If not then put the echo command in /etc/rc.local


Once your iptables rules are set the way you need them run this command..

service iptables save


The saved rules will be applied on reboot.





Plugging in your other computers will not get the network going unless you have dhcp enabled on all computers and a server on the network (could be the same machine if you want a DHCP server on your LAN), or you can have static ip addresses and DNS manually configured.

If the linux box is going to be the DHCP server setup it's LAN interface with a static ip, configure the DHCP server for that LAN's network, make it the router in your DHCP config, and setup the DNS servers in you DHCP config.




Last edited by DavidPhillips; 06-09-2005 at 08:36 AM.
 
  


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
installing linux on a computer and use hard disk on another computer danrweki Linux - Newbie 8 11-16-2005 11:11 PM
Internet is slower on my win computer than on my linux computer eXor Linux - Networking 1 12-03-2004 09:58 AM
Can't copy files from an SCO Unix System V computer to a Linux computer gnppapas Linux - General 2 11-27-2004 02:39 PM
Why would a windows computer smoke a linux computer for download speed ? lostboy Linux - General 4 10-21-2003 06:20 PM
How can i portage Linux from computer with Celeron proc to computer with Pentium 166? gdi Linux - General 4 05-31-2003 02:11 AM


All times are GMT -5. The time now is 10:32 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration