Jump to content
xisto Community
vizskywalker

How Do I Use Linux To Create A Switch From Multiple Ethernet Ports

Recommended Posts

I have a Linux box with three ethernet ports (NIC cards). I could easily give it more. I have one ethernet connection to the outside world at college. College's ethernet policy is amazing, as they give us IP addresses that in theory are fully routable from the outside world (haven't had a chance to try it out). Unfortunately, I have another computer, my primary laptop, that is connected to the internet, and no switch or router.I was wondering how to use my Linux box as either a switch or router. What I want to do is the following:1) Connect the Linux box to the room ethernet port to give it internet and network access.2) Connect my other computers to the other NIC cards so they also have access to the internet and network.Since I can request an IP for each of my computers, and the IPs are fully routable, I was also wondering if it would be possible to somehow give each of my computers their own IP that the college gives me and maintain that outside access via IP.Any help would be appreciated. I think I explained this pretty well, but if you have questions, please ask.~Viz

Share this post


Link to post
Share on other sites

Each "slave" computers will have fixed IP, I agree.Each one of these computers must have :. the primary one as default gateway when you configure the slave NIC's properties.. they must also have a valid DNS. Look at your primary computer the address of the DNS, and eventually the address of the Internet proxy.Then, this should work.

Share this post


Link to post
Share on other sites

Okay, I think I have that set up, but let me give you the current configuration to be sure, because it isn't working.Linux Box:eth0: the card the other computer plugs intoactiveip: 192.168.1.1subnetmask: 255.255.248.0default gateway: 134.176.60.121eth2: the card that connects to the internetactiveip: 134.176.60.121subnetmask: 255.255.248.0default gateway: 134.173.63.200DNS for the machinePrimary: 134.173.53.8Secondary: 134.173.254.23DNS Search PAth: localdomainWindows Box (the remote machine)Local Area Connection - the ethernet not wirelessip: 134.173.60.56subnetmask: 255.255.248.0default gateway: 192.168.1.1Primary DNS: 134.173.53.8Secondary DNS: 134.173.254.23~Viz

Share this post


Link to post
Share on other sites

This is false :

Windows Box (the remote machine)Local Area Connection - the ethernet not wireless
ip: 134.173.60.56
subnetmask: 255.255.248.0
default gateway: 192.168.1.1

ip of this machine must be 192.168.1.XXX (XX=5 or 6 or what you want).

This IP must be on the same network (192.168.1.___ as the computer at the other hand, which is 192.168.1.1.


Hope his thelped

Yordan

Share this post


Link to post
Share on other sites

Or maybe the best thign is to use DNS from the Linux box?Let the windows pc pick up the settings via DNS..That way if you need to add another pc you will have lots of spare IPs to play with.Im going out again just now like last night when we got talking about this..best thing to do is use google to search for setting up linux DNS and firewallIts fairly easy to do you just need to set a range of IPs like 192.168.1.5 to 192.168.1.255 and now you can have 200 devices connected if you want.Also like I mentioned last night..you can make a really good firewall for the inside network with just a few lines in your config file..hopefully you can google up a tutorual..if not Il get one for you tomorrow..Also you will need NAT and port forwarding to allow programs like ftp smtp torrents..games etc specific routes tho the firewall and through the NAT to route directly to any inside IPs ports..Something like this..134.176.60.121:21 to 192.168.2.5:21 that would be ftp..note i put a static IP in there? you can do it with DNS IP's too but I forget how to right now..ill post it up tomorrow when i get home..Ive made a great firewall/switch/router from an old 486 with 64mb ram and a floppy drive and no hard drive before...once it was setup it just booted from the floppy..loaded the ipchains..dns..routign tables etc..and was good to go!! no monitor no kb no mouse on it..it just sat in the closet and was the best router you could ever have :P)Hope this helps a littleMarky;)

Share this post


Link to post
Share on other sites

Okay, one key issue, the IPs I am given by school are fully routable to the outside world, and I would like to maintain that. So the IPs, if I can set this up properly are restricted.I also need to be able to use this Linux machine as a computer.Before I go looking for DNS tutorials, could you provide some more details on how the DNS setup and NAT work.~Viz

Share this post


Link to post
Share on other sites

Simply use my tricks if you want to use your own IP addresses, you don't need DNS nor nat nor firewall.Firewall will be an axtra bonus for the next step, when everything will be working fine.

Share this post


Link to post
Share on other sites

@yordanThe current configuration is subnet mask on both changed to 255.255.255.0ip of windows is 192.168.1.101no other changes.Still nothing happeningNeither computer is reading a link between the two.Do I need to have a dhcp server or something running, and if so, how.~Viz

Share this post


Link to post
Share on other sites

Neither computer is reading a link between the two.

Ach ! this means that you have a hardware problem now! A computer should see a link as soon as you plug a cable.If no computer sees a link, that means that you have a cable problem.
If you have a rather old PC, you need a true crossed Ethernet cable, which is not the case with the modern Ethernet adapters.
Try to borrow a crossed cable, and you should see the lamps on the adapters on as soon as you plug the cable. If no lamp come up or Windows sees no network, this means that your cable is bad, or your adapter has a problem.
Edited by yordan (see edit history)

Share this post


Link to post
Share on other sites

I know the cable isn't bad, I'm working on checking the adapter, and it may need a crossover cable, but I highly doubt it. Looking into getting one though. Will I need to bridge the adapter that connects to the internet with the other connections, and if so how?And yordan, If I have specific IP addresses that are fully routable to the rest of the world, I'm not sure I understand how your method of assigning an IP address to the adapter on the Linux box and using that as the default gateway for the other connections will accomplish this.~Viz

Share this post


Link to post
Share on other sites

ip of windows is 192.168.1.101

This IP is not an official worldwide addres routable all around the world. This is a fully private address, only your main PC can route it to the rest of the world.

Share this post


Link to post
Share on other sites

With that IP I was simply trying to get the two machines to talk. I have two IPs that are fully routable, one for each machine. Since right now I can get the Linux box talking to the rest of the world, but not the Windows machine. So only the Linux box has a fully routable IP address. But the end result I want is both having fully routable IP addresses.~Viz

Share this post


Link to post
Share on other sites

OK, so, now, on your main PC, you have :1) one network adapter fully working, connected to the internet.2) one spare network adapter, to be connected to the second pc.Now, On the main PC, on the spare network adapter, configure the following IP address : 192.168.1.2On the second PC, configure the IP address 192.168.1.3Put a crossed cable between the two adapters you just configured.From each PC, ping 192.168.1.2 and 192.168.1.3Both addresses must ping from each PC.When this step is achieved, the physical link is working, we will see the rest firthermore.

Share this post


Link to post
Share on other sites

So right now I think the issue is that I need a crossover cable, so I'm trying to locate one of those. But I still don't understand how the Linux box will understand to pass internet data from the card connected to the internet to the card connected to my Windows box or pass requests from the card connected to the Windows box on through the card connected to the net.~Viz

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.