Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
so i am running Fedora in my main workstation, which is always awake and doing most of my work in it.
This box has a wireless internet connection with my ADSL router, cause of the long distance from my room. But i need somehow to share this connection to other boxes with the ethernet connection. I ve got a 8port switch and i want to connect to the main box and connect other boxes to this switch so they 've got internet.
How should i do this? How should i configure my main box, to share the wireless connection to its ethernet subnetwork? Iptables? Routes?
Basically iptables... and set your boxes to use the internal IP of your linux box to use it as default gw.
Then, in the linux box, make sure that there's a rule or policy in FORWARD that will this packets coming from these boxes to go through and add this rule to your linux box:
Code:
iptables -t nat -A POSTROUTING -o internet-interface -j MASQUERADE
In internet-interface use the interface that's connected to internet (wlan0, eth0, eth1, whatever).
And make sure that /proc/sys/net/ipv4/ip_forward is set to 1:
now please a few questions. My main box is acting as a router. First what these means?
Quote:
[kostas@bigbox ~]$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.2.0 0.0.0.0 255.255.255.0 U 1 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 2 0 0 wlan0
0.0.0.0 192.168.1.254 0.0.0.0 UG 0 0 0 wlan0
0.0.0.0 192.168.1.254 0.0.0.0 UG 0 0 0 eth0
second, the boxes from the subnet where are they getting DNS from? I should give them manually, right?
and in the system-config-firewall i had allready enable the MASQUERADE option for my internet interface but i had to pass it to iptables too to work. Why is that??
0.0.0.0 192.168.1.254 0.0.0.0 UG 0 0 0 wlan0
0.0.0.0 192.168.1.254 0.0.0.0 UG 0 0 0 eth0
That doesn't look right, man.
It should be
Code:
0.0.0.0 192.168.1.254 0.0.0.0 UG 0 0 0 wlan0
Cause you said you are connected to internet through the wireless, right? That is the only default gw you should set. The other routing lines look ok. By the way, I prefer the output of "ip route show", but that's just me.
About DNS... well, I guess!... If you have set up a dhcp service, you can tell them to use whatever DNS you like from there so you don't have to go through each box to configure it. If you are using static IPs, then you are busted and will have to do it by hand.
And about the firewall configuration: I have nooooo idea. In general I like to set up my netfilter (aka iptables) stuff by hand.
Could install a small VM that has all the firewall features you want too then run it as if it were a dedicated box. Might look at untangle.com's firewall, already made in a VM at vmware.
[
kostas@bigbox ~]$ ip route show
192.168.2.0/24 dev eth0 proto kernel scope link src 192.168.2.254 metric 1
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.65 metric 2
default via 192.168.1.254 dev wlan0
default via 192.168.1.254 dev eth0 proto static
Thank you eantoranz and jefro
here's ip's output. the whole configuration is working normal. But i haven't restart my pc yet, i should do that too.
I would tell you to remove the last line as it doesn't work... as a matter of fact, it's kind of crazy given that you won't find that router (192.168.1.254) on dev eth0.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.