LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-24-2013, 05:16 AM   #1
pranix
LQ Newbie
 
Registered: Aug 2013
Posts: 5

Rep: Reputation: Disabled
two NICs one switch


I'm new to networking, but I want an internal network between two machines that are already on a subnet (with static/public IP's each)

Given both machines have a spare NIC's - can I just hook them upto the same switch and make one machine the gateway? Or is there a simpler way of setting up VLAN's? Any thoughts?

Last edited by pranix; 08-24-2013 at 12:35 PM.
 
Old 08-24-2013, 12:31 PM   #2
baldy3105
Member
 
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 891

Rep: Reputation: 184Reputation: 184
Not sure I follow. You have two hosts with two nics each?
Each host is connected via one nic to a switch?
The switch ports are what, Access (or member) ports in one vlan, call it vlanX?
The hosts both in the same existing subnet and are talking to the outside world via a 3rd host or router acting as a gateway?

You want to connect between the two hosts on a separate subnet? For what purpose?

Assuming the above is correct you have three choices.
1. crossover cable between the two hosts second nic
2. second nics connect to a new switchport each, the new switchports are made access ports of vlanY
3. the existing nics are reconfigured as 802.1q tagged trunks and vlanX and Y are trunked between the two existing nics

We need a clearer description of where you are and where you want to get to to be more specifically helpful :-)

Diagrams are the best if you can run up visio or dia (or indeed kivio)
 
Old 08-24-2013, 12:43 PM   #3
pranix
LQ Newbie
 
Registered: Aug 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
I meant switch not NIC, my bad. (But have edited original post now). Below are answers -

Not sure I follow. You have two hosts with two nics each? - Yes
Each host is connected via one nic to a switch? - Yes
The switch ports are what, Access (or member) ports in one vlan, call it vlanX? - Yes, but not sure of Vlan - but all are on same subnet (physical ethernet ports connecting to switch and onto a core switch within a DC)
The hosts both in the same existing subnet and are talking to the outside world via a 3rd host or router acting as a gateway? - Talking straight to outside world (public DNS set with gateway/router on same subnet, no 3rd host)

You want to connect between the two hosts on a separate subnet? For what purpose? - Not just two hosts, but more, I mentioned to keep it simple. Purpose is to have more virtualbox vm's to be configured over a bridged interface.


I hope it's clearer - but will try and put it onto a visio/dia if necessary.

Thanks again.
 
Old 08-26-2013, 06:31 PM   #4
baldy3105
Member
 
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 891

Rep: Reputation: 184Reputation: 184
OK, so to keep it simple,
assign nic2 to the vm and connect it to the switch.
create a new vlan on the switch, and make the new ports members of that vlan.
Create a new subnet and assign addresses to the VM.s 2nd nic.

At this point your VM's should be able to talk amongst themselves via this new vlan/subnet.
If you want to route traffic via this subnet you will need to get the subnet added to the router/gateway. You will then need need to add a route to the vm's for whichever networks you need to talk to via the routers new subnet address.

I'm assuming the VM's already have a default route via the existing subnet and router. If this is the case DO NOT add another default route to the VM's. I cannot stress this enough, the number of times I have had to fix this are beyond count.....

For each host real or virtual you have ONE default route. Any other routing must be by explicit routing.
 
Old 08-27-2013, 10:39 AM   #5
pranix
LQ Newbie
 
Registered: Aug 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
The servers are connected to a dumb switch, and then onto a core DC switch. I don't have access to the gateway too.
Am wondering to replace the dumb-switch with something where I can create VLAN's on, unless there are other ways to get around.

I did try to create VLAN's on these servers over the existing interface - but that breaks my access over the switch (although it works fine from within) - not sure why though.
 
Old 08-27-2013, 12:11 PM   #6
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7 / 8
Posts: 3,551

Rep: Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599Reputation: 1599
With networking, KEEP IT SIMPLE

But a new cheap switch and plug them in to that rather than going to the expense of a switch that will support vlan or port segmentation.
 
Old 08-27-2013, 12:38 PM   #7
pranix
LQ Newbie
 
Registered: Aug 2013
Posts: 5

Original Poster
Rep: Reputation: Disabled
Yes - I love keeping it simple.

But now that many of my networking assumptions have fallen apart - I want to be sure this one extra switch to connect all 2nd NIC's is going to solve. Also, that any of the servers can be the gateway without any routes set up. Or am I completely mistaken?
 
Old 08-30-2013, 07:16 PM   #8
baldy3105
Member
 
Registered: Jan 2003
Location: Cambridgeshire, UK
Distribution: Mint (Desktop), Debian (Server)
Posts: 891

Rep: Reputation: 184Reputation: 184
You can use a second switch if thats cheaper/easier but all you have done is to create a switched network over which all the servers can talk.

This would be typical for doing things like database replication that avoids using the main network.

But when you say you want any of the servers to act as a gateway? Where to? All of your servers are already connected to the outside world via the gateway on your existing network so they would not need to route via each other.

Look -
Click image for larger version

Name:	Diagram.jpg
Views:	37
Size:	59.3 KB
ID:	13314

Adding a new switch will connect your servers and allow them to talk via the new IP network you assign. To talk to anything else they will go via the existing gateway. If you want to route somewhere that is not available via your current gateway then you need another gateway, weather its a router or a server with forwarding enabled, which needs to be connected physically and logically to your new network.

You need to start drawing pictures. First draw out exactly where you are, then draw out exactly what it is you are trying to achieve, because you seem to keep adding pieces to the puzzle. Get it clear in your head what you are trying to achieve, then it will be easier for us to help you get there :-)

Last edited by baldy3105; 08-30-2013 at 07:20 PM.
 
  


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
I have 3 nics on squid and need a script to switch nics teky68 Linux - Newbie 2 12-15-2012 04:48 PM
I have an old linuxbox and some unused NICs. Can I turn that into a router/switch? garyozzy Linux - Networking 5 03-16-2011 10:44 PM
building a router with multiple nics (no external switch) xtravar Linux - Networking 2 07-19-2009 02:39 PM
Two NICs second nic plugs into a switch with no router chackercon Linux - Networking 9 03-03-2009 10:00 AM
Make a Hub/Switch out of Linux Box with Multiple NICs? sancho Linux - Networking 1 07-15-2007 04:54 PM

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

All times are GMT -5. The time now is 01:11 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