LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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 01-12-2014, 05:19 PM   #1
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
Question on assigning ip addresses to multiple nics on Linux router


I'm using VirutalBox to host three Lubuntu machines which have static ip addresses (class c) and I want to have another Lubuntu machine server as a router and another Lubuntu machine provide DNS/DHCP services.

My question is on the router, since it has two nics, can the gateway address also be one of the addresses for eth1?

Code:
 

# interfaces(5) file used by ifup(8) and ifdown(8)

auto lo
iface lo inet loopback 

auto eth0 
iface eth0 inet static 
address 192.168.1.111
netmask 255.255.255.0 
gateway 192.168.1.110 

auto eth1 
iface eth0 inet static 
address 192.168.1.110
netmask 255.255.255.0 
gateway 192.168.1.110
 
Old 01-12-2014, 06:59 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,341

Rep: Reputation: Disabled
You have two NICs with IP addresses in the same IP network (192.168.1.0/24). That in itself is uncommon, but not necessarily wrong. If you're trying to set up a router, then it most certainly is wrong, because routing implies different IP networks.

Then you have two gateways on the same system, which is pointless, and both refer to the machine itself, which makes absolutely no sense at all.

Exactly what are you trying to accomplish? Is this system to act like a router between two network segments (physical or virtual)?
 
Old 01-12-2014, 08:50 PM   #3
JockVSJock
Senior Member
 
Registered: Jan 2004
Posts: 1,420

Original Poster
Blog Entries: 4

Rep: Reputation: 164Reputation: 164
What I'm trying to learn right now is setting up a small network on Linux machines in VirutalBox. Along with one of the machines serving as a router, and then set up another one as a DHCP/DNS Server.

I didn't know that on the router, that we need to have different ip addresses for the two NICS. Now that I know this, that make total sense. Thanks for pointing that out.
 
Old 01-13-2014, 05:17 AM   #4
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 3,341

Rep: Reputation: Disabled
NICs on VirtualBox VMs can be configured in four different ways:
  • Internal network: A virtual switch with no connection to the outside world.
  • Host network: Much the same as an "internal" network, except the VirtualBox hypervisor has a virtual NIC in each host network.
  • Bridged: The VM NIC is bridged to one of the NICs on the hypervisor host.
  • NAT: The VM NICs are placed in a special, virtual network with a virtual router. This router has DNS and DHCP functionality (the default IP network is 192.168.56.0/24), and will NAT outbound traffic behind the IP address of the hypervisor host.
Your router will need one NIC in an "internal" zone and one which is either bridged to a NIC on the hypervisor host or put in the "NAT" zone. The VMs that are to be served by this router should have their NICs in the same "internal" zone.

The IP network in the "internal" zone will have to be different from all your other networks. Any private IP network you're not already using will do fine.
 
  


Reply

Tags
multiple nics



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
building a router with multiple nics (no external switch) xtravar Linux - Networking 2 07-19-2009 01:39 PM
LXer: Tutorial: Assigning Multiple Addresses to a Network Interface LXer Syndicated Linux News 0 10-10-2008 04:30 PM
Linux setup as router / DHCP w/3+ NICs, separate but shared connectivity - question MetaTechi3 Linux - Networking 3 11-17-2006 11:41 AM
assigning different IP addresses in a linux machine? hegdeshashi Linux - Networking 4 01-04-2006 02:13 AM

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

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