LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 10:32 PM   #1
DJOtaku
Member
 
Registered: Oct 2004
Location: USA
Distribution: Fedora 25;CentOS 7; Kubuntu; Debian
Posts: 860

Rep: Reputation: 37
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, 02:05 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
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, 11:27 AM   #3
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
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 11:42 AM.
 
Old 06-04-2005, 08:29 PM   #4
DJOtaku
Member
 
Registered: Oct 2004
Location: USA
Distribution: Fedora 25;CentOS 7; Kubuntu; Debian
Posts: 860

Original Poster
Rep: Reputation: 37
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, 07:22 AM   #5
DavidPhillips
LQ Guru
 
Registered: Jun 2001
Location: South Alabama
Distribution: Fedora / RedHat / SuSE
Posts: 7,163

Rep: Reputation: 58
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 07:36 AM.
 
  


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

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

All times are GMT -5. The time now is 08:46 PM.

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