LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-22-2011, 05:16 PM   #1
drManhattan
Member
 
Registered: Aug 2010
Location: Warsaw, Poland
Distribution: Ubuntu 10.04 LTS on IBM Lenovo R61e, RHEL5-6,SLES10-11
Posts: 262

Rep: Reputation: 1
multiple IP from different subnets on 1 NIC


Hi

I added IP alias to my NIC from 2 different subnets.
I did this by using 2 methods :
--------------------------------
1. ip address add 10.0.0.1/24 brd + dev eth0
ip address add 10.0.1.1/24 brd + dev eth0

2. ip address add 10.0.0.1/24 brd + dev eth0 label eth0:0
ip address add 10.0.1.1/24 brd + dev eth0 label eth0:0


In regard on 1 method :
------------------------
I saw that when I performed cmd `ip address show`, it shows 2 IP.
Code:
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
    link/ether f0:de:f1:36:5d:86 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.1/24 brd 10.0.0.255 scope global eth0
    inet 10.0.1.1/24 brd 10.0.1.255 scope global eth0
But when I perform cmd `ifconfig eth0`, it doesn't show two IPs only one IP.
Code:
[root@oc1825758758 ~]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr F0:DE:F1:36:5D:86  
          inet addr:10.0.0.1  Bcast:10.0.0.255  Mask:255.255.255.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
          Interrupt:20 Memory:f2600000-f2620000
Both IPs are pinging, so can work.

Why is it so that configuring 2 IPs on 1 interface by using 1 method, hides IP alias ?


In regard on 2 method :
------------------------
When I use this method, linux shows me eth0 and eth0:0 interfaces with different IPs on them and everything is understandable.


BIG QUESTION :
--------------
Whether I need switch port in trunk mode to allow communication to those 2 IPs from different networks or switch port mode access is fine ?


thx for help.
 
Old 08-22-2011, 06:25 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
You'll need to configure vlans on the linux host and enable trunking on the hosts port at the switch.
 
Old 08-23-2011, 01:19 AM   #3
lystor
Member
 
Registered: May 2010
Location: Ukraine
Posts: 43

Rep: Reputation: 3
Quote:
Originally Posted by drManhattan View Post
Hi
Why is it so that configuring 2 IPs on 1 interface by using 1 method, hides IP alias ?
Hi
Because ifconfig is an old tool that supports less features than ip (iproute package).

Quote:
Originally Posted by drManhattan View Post
Whether I need switch port in trunk mode to allow communication to those 2 IPs from different networks or switch port mode access is fine ?
You don't need that until you split your network to multiple VLANs for security reasons or for limiting broadcasts domain.
 
  


Reply



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
Help with iptables, 2 nic's + 2 subnets bilbod Linux - Networking 3 06-23-2009 12:58 AM
PF - Handling multiple subnets Kristijan *BSD 2 04-04-2007 05:11 PM
Multiple Subnets lucasnishimura Linux - Networking 1 08-07-2005 11:32 AM
help with arpwatch and snort using 2 NIC and multiple subnets benwaynet Linux - Security 0 12-20-2004 01:22 PM
Routing multiple subnets to multiple wans raven1000x Linux - Networking 1 03-10-2004 02:29 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

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