Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: error with Multiple IP address in the same interface

  1. #1
    Join Date
    Oct 2011
    Beans
    3

    error with Multiple IP address in the same interface

    Hello,

    I need to configure multiple IP address in only one ethernet interface card (eth0). I have Ubuntu Server 11.10 64bits and I have configured "/etc/network/interfaces" as follows:

    auto lo
    iface lo inet loopback

    auto eth0
    iface eth0 inet static
    address net1-IP
    netmask 255.255.255.192
    gateway net1-GW
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 8.8.8.8 8.8.4.4
    pre-up iptables-restore < /etc/iptables.rules

    auto eth0:1
    iface eth0:1 inet static
    address net2-IP
    netmask 255.255.0.0


    But if I execute "ifconfig" i can only view the eth0 and lo interfaces:

    eth0 Link encap:Ethernet direcciónHW d0:27:88:75:c2:90
    Direc. inet:net1-IP Difus.:0.0.0.0 Másc:255.255.255.192
    Dirección inet6: fe80::d227:88ff:fe75:c290/64 Alcance:Enlace
    ACTIVO DIFUSIÓN FUNCIONANDO MULTICAST MTU:1500 Métrica:1
    Paquetes RX:2371126 errores:0 perdidos:925 overruns:0 frame:0
    Paquetes TX:987219 errores:0 perdidos:0 overruns:0 carrier:0
    colisiones:0 long.colaTX:1000
    Bytes RX:306355542 (306.3 MB) TX bytes:285228911 (285.2 MB)
    Interrupción:40 Dirección base: 0x4000

    lo Link encap:Bucle local
    Direc. inet:127.0.0.1 Másc:255.0.0.0
    Dirección inet6: ::1/128 Alcance:Anfitrión
    ACTIVO BUCLE FUNCIONANDO MTU:16436 Métrica:1
    Paquetes RX:28563 errores:0 perdidos:0 overruns:0 frame:0
    Paquetes TX:28563 errores:0 perdidos:0 overruns:0 carrier:0
    colisiones:0 long.colaTX:0
    Bytes RX:2559324 (2.5 MB) TX bytes:2559324 (2.5 MB)

    # ifconfig eth0:1
    eth0:1 Link encap:Ethernet direcciónHW d0:27:88:75:c2:90
    ACTIVO DIFUSIÓN FUNCIONANDO MULTICAST MTU:1500 Métrica:1
    Interrupción:40 Dirección base: 0x4000


    But, "netstat -putan" shows me several service listening in the second IP. For example the NTP service:


    udp 0 0 net2-IP:123 0.0.0.0:* 1322/ntpd
    udp 0 0 net1-IP:123 0.0.0.0:* 1322/ntpd
    udp 0 0 127.0.0.1:123 0.0.0.0:* 1322/ntpd
    udp 0 0 0.0.0.0:123 0.0.0.0:* 1322/ntpd
    udp6 0 0 ::1:123 :::* 1322/ntpd
    udp6 0 0 fe80::d227:88ff:fe7:123 :::* 1322/ntpd
    udp6 0 0 :::123 :::* 1322/ntpd

    What is happenging here????!

    Thanks,

    Christian

  2. #2
    Join Date
    Jan 2009
    Location
    Denmark
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: error with Multiple IP address in the same interface

    What!?

    You cannot have more then one IPv4 or IPv6 address or mac address for that matter on one interface. Ethernet, Fast-Ethernet, Gigabit-Ethernet, Fiber and so on.

    Also why o why would you do such a thing?

    Kind regards.

    Edit.
    Quick search on google.
    If you wanna do this because of this example.
    This tutorial demonstrates how to bind multiple IP addresses to a single NIC. By using multiple IP's you can run a service under a specific IP while having another service under a different one (for example, have HTTP on one and SMTP on another), or create a private LAN using a local IP and have the alias hold your Internet IP (such as NAT). One of the major benefits is that you don't need a physical adapter for each IP but instead can create many virtual ones tied to a single physical card. The instructions provided apply to RedHat, Fedora, and CentOS. I'll be using LAN IP's in this example, so replace them with the ones you'll be using.
    You deserve a punch in the nutts.
    Just specify different ports for the different services with NAT. And use a single ip address.
    Last edited by Drenriza; October 27th, 2011 at 10:36 AM.

  3. #3
    Join Date
    May 2008
    Location
    SoCal
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: error with Multiple IP address in the same interface

    Quote Originally Posted by Drenriza View Post
    What!?

    You cannot have more then one IPv4 or IPv6 address or mac address for that matter on one interface. Ethernet, Fast-Ethernet, Gigabit-Ethernet, Fiber and so on.
    Sure you can. IP Aliasing has been part of the Linux kernel for a long time.

    Also why o why would you do such a thing?

    Kind regards.

    Edit.
    Quick search on google.
    If you wanna do this because of this example.


    You deserve a punch in the nutts.
    Just specify different ports for the different services with NAT. And use a single ip address.
    Pretty judgmental there don't you think. Read up on the technique BEFORE you start telling folks they are wrong. You can start with this article from IBM on the subject.
    -BAB1

  4. #4
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    12,985
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: error with Multiple IP address in the same interface

    Code:
    auto eth0
    iface eth0 inet static
    address net1-IP
    netmask 255.255.255.192
    gateway net1-GW
    Shouldn't the address lines in /etc/network/interfaces have IP address entries? Even if net1-IP is in /etc/hosts, I'm not sure that the network startup scripts will do any name resolution. Just put the actual addresses in there for the "address" and "gateway" fields, not symbolic names.

    I've used interface aliasing when I wanted to have a separate HTTP and HTTPS servers on the same box. Since HTTPS doesn't take too well to name-based virtual hosts, it's easier to assign a second IP address to the NIC and bind the HTTPS server to that address.

    Of course you need an ISP that will give you an IP subnet, not just a single address to make this work. Many ISPs will give their commercial customers a /29 or even a /28, though that's less common in these days of IP address shortages.

    The netmask you're using (255.255.255.192) is for a /26, or 62 usable addresses. Did your ISP really give you a /26? Pretty generous if so.
    Last edited by SeijiSensei; October 28th, 2011 at 12:03 AM.

  5. #5
    Join Date
    Oct 2011
    Beans
    3

    Re: error with Multiple IP address in the same interface

    Quote Originally Posted by SeijiSensei View Post
    Code:
    auto eth0
    iface eth0 inet static
    address net1-IP
    netmask 255.255.255.192
    gateway net1-GW
    Shouldn't the address lines in /etc/network/interfaces have IP address entries? Even if net1-IP is in /etc/hosts, I'm not sure that the network startup scripts will do any name resolution. Just put the actual addresses in there for the "address" and "gateway" fields, not symbolic names.
    I have put "net1-IP" and "net1-GW" instead of the IP address that I have in the /etc/network/interfaces files. It's only because I didn't want to show the IP address of the server


    Quote Originally Posted by SeijiSensei View Post
    I've used interface aliasing when I wanted to have a separate HTTP and HTTPS servers on the same box. Since HTTPS doesn't take too well to name-based virtual hosts, it's easier to assign a second IP address to the NIC and bind the HTTPS server to that address.

    Of course you need an ISP that will give you an IP subnet, not just a single address to make this work. Many ISPs will give their commercial customers a /29 or even a /28, though that's less common in these days of IP address shortages.

    The netmask you're using (255.255.255.192) is for a /26, or 62 usable addresses. Did your ISP really give you a /26? Pretty generous if so.
    We are an ISP so we don't have that problem .

    I agree with you regarding to interface aliasing is very old, but it seems to be well configured as you can see in my /etc/network/interfaces file but ifconfig don't show the interface aliases:

    Code:
    root@server:~# ifconfig
    eth0      Link encap:Ethernet  direcciónHW d0:27:88:75:c2:90
              Direc. inet:X.X.X.X  Difus.:0.0.0.0  Másc:255.255.255.192
              Dirección inet6: fe80::d227:88ff:fe75:c290/64 Alcance:Enlace
              ACTIVO DIFUSIÓN FUNCIONANDO MULTICAST  MTU:1500  Métrica:1
              Paquetes RX:4458717 errores:0 perdidos:1674 overruns:0 frame:0
              Paquetes TX:1717477 errores:0 perdidos:0 overruns:0 carrier:0
              colisiones:0 long.colaTX:1000
              Bytes RX:586832356 (586.8 MB)  TX bytes:432502236 (432.5 MB)
              Interrupción:40 Dirección base: 0x4000
    
    lo        Link encap:Bucle local
              Direc. inet:127.0.0.1  Másc:255.0.0.0
              Dirección inet6: ::1/128 Alcance:Anfitrión
              ACTIVO BUCLE FUNCIONANDO  MTU:16436  Métrica:1
              Paquetes RX:53176 errores:0 perdidos:0 overruns:0 frame:0
              Paquetes TX:53176 errores:0 perdidos:0 overruns:0 carrier:0
              colisiones:0 long.colaTX:0
              Bytes RX:4708318 (4.7 MB)  TX bytes:4708318 (4.7 MB)
    
    root@server:~# ifconfig eth0:1
    eth0:1    Link encap:Ethernet  direcciónHW d0:27:88:75:c2:90
              ACTIVO DIFUSIÓN FUNCIONANDO MULTICAST  MTU:1500  Métrica:1
              Interrupción:40 Dirección base: 0x4000
    It seems a bug, it isn't? or Am I doing something bad?

  6. #6
    Join Date
    Jan 2009
    Location
    Denmark
    Beans
    Hidden!
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: error with Multiple IP address in the same interface

    Pretty judgmental there don't you think. Read up on the technique BEFORE you start telling folks they are wrong.
    If you think i am unknowing about this, then inlighten me. In what situation it would be beneficial to split a single network NIC to multiple ip addresses.

  7. #7
    Join Date
    Nov 2008
    Location
    Metro Boston
    Beans
    12,985
    Distro
    Kubuntu 14.04 Trusty Tahr

    Re: error with Multiple IP address in the same interface

    Quote Originally Posted by chrpinedo View Post
    It seems a bug, it isn't? or Am I doing something bad?
    Perhaps it's not possible to do this through the interfaces file?

    What happens if you remove the entry for eth0:1 from that file then configure the interface manually with ifconfig? When I've used aliasing, I've assigned the address to the aliased interface with an ifconfig command in /etc/rc.local.

    Quote Originally Posted by Drenriza View Post
    If you think i am unknowing about this, then inlighten me. In what situation it would be beneficial to split a single network NIC to multiple ip addresses.
    Read my post above for one example.

  8. #8
    Join Date
    Dec 2008
    Location
    Deep Woods of PA
    Beans
    699
    Distro
    Kubuntu 11.10 Oneiric Ocelot

    Re: error with Multiple IP address in the same interface

    Quote Originally Posted by Drenriza View Post
    If you think i am unknowing about this, then inlighten me. In what situation it would be beneficial to split a single network NIC to multiple ip addresses.
    If you are listening to multiple vlans on the same interface when aggregating certain feeds to come to one physical interface. Hardware clustering such as Veritas Cluster server.
    Regards,

    Karlson

  9. #9
    Join Date
    Jul 2008
    Beans
    Hidden!
    Distro
    Ubuntu 14.04 Trusty Tahr

    Re: error with Multiple IP address in the same interface

    Quote Originally Posted by chrpinedo View Post
    I have put "net1-IP" and "net1-GW" instead of the IP address that I have in the /etc/network/interfaces files. It's only because I didn't want to show the IP address of the server




    We are an ISP so we don't have that problem .

    I agree with you regarding to interface aliasing is very old, but it seems to be well configured as you can see in my /etc/network/interfaces file but ifconfig don't show the interface aliases:

    Code:
    root@server:~# ifconfig
    eth0      Link encap:Ethernet  direcciónHW d0:27:88:75:c2:90
              Direc. inet:X.X.X.X  Difus.:0.0.0.0  Másc:255.255.255.192
              Dirección inet6: fe80::d227:88ff:fe75:c290/64 Alcance:Enlace
              ACTIVO DIFUSIÓN FUNCIONANDO MULTICAST  MTU:1500  Métrica:1
              Paquetes RX:4458717 errores:0 perdidos:1674 overruns:0 frame:0
              Paquetes TX:1717477 errores:0 perdidos:0 overruns:0 carrier:0
              colisiones:0 long.colaTX:1000
              Bytes RX:586832356 (586.8 MB)  TX bytes:432502236 (432.5 MB)
              Interrupción:40 Dirección base: 0x4000
    
    lo        Link encap:Bucle local
              Direc. inet:127.0.0.1  Másc:255.0.0.0
              Dirección inet6: ::1/128 Alcance:Anfitrión
              ACTIVO BUCLE FUNCIONANDO  MTU:16436  Métrica:1
              Paquetes RX:53176 errores:0 perdidos:0 overruns:0 frame:0
              Paquetes TX:53176 errores:0 perdidos:0 overruns:0 carrier:0
              colisiones:0 long.colaTX:0
              Bytes RX:4708318 (4.7 MB)  TX bytes:4708318 (4.7 MB)
    
    root@server:~# ifconfig eth0:1
    eth0:1    Link encap:Ethernet  direcciónHW d0:27:88:75:c2:90
              ACTIVO DIFUSIÓN FUNCIONANDO MULTICAST  MTU:1500  Métrica:1
              Interrupción:40 Dirección base: 0x4000
    It seems a bug, it isn't? or Am I doing something bad?
    That seems odd. What do you get with
    Code:
    ifconfig -a

  10. #10
    Join Date
    Jan 2010
    Location
    Portugal
    Beans
    160
    Distro
    Ubuntu Development Release

    Re: error with Multiple IP address in the same interface

    Hello!

    What you want it's perfectly normal.

    But you need to do something more then that!
    With the information that you're giving, i can see that both ip's are from different network, so the server must be connected to a port on the switch, with both Vlans configured.
    After that, you can follow this:
    https://wiki.ubuntu.com/vlan

    If you need more help, just pass-by!

    Best regards!
    Javali
    Administração e Desenvolvimento de Sistemas Informáticos, Lda.
    Open Source Systems / SugarCRM / Alfresco / Drupal / Openbravo
    http://www.javali.pt info at javali.pt

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •