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