Single NIC, multiple ip addresses

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Single NIC, multiple ip addresses

Liam Kirsher

Hi,

Need some help here, and I really hope this is the right place to ask!
It seems like it should be simple.  I just need to have a single XenServer, single NIC, with VMs having multiple different IP addresses.

I have a XenServer 6.2 with two NICs: NIC0 and NIC1.  But I'm only getting connected to NIC0 from the ISP.
The dom0 is set up with like this.

address 162.x.x.13
gateway 162.x.x.1
netmask 255.255.255.24
network 162.x.x.x0

The ISP has given me additional ip addresses to use in the same subnet for a couple of VMs.

I'm using XenCenter.  What I think I need to do and have tried, is

1. Create a Network (calling it "VLAN 100") on dom0 using XenCenter, attached to NIC 0, with VLAN setting (I'm using 100, but it seems arbitrary).
2. Clicking on Configure in XenCenter Networking->IP Address Configuration, I add "External Network" connected to VLAN 100, with settings like
address 162.x.x.16
netmask 255.255.255.224
gateway 162.x.x.1

3. On the domU I "Add Interface" with Network "VLAN 100".

4. In domU /etc/network/interfaces file I have put

allow-hotplug eth0:100
auto eth0:100

# The external network interface
iface eth0:100 inet static
 address 162.x.x.16
 netmask 255.255.255.224
 network 162.x.x.0
 broadcast       162.x.x.31
 gateway 162.x.x.1

However, traffic does not seem to get routed to the VM, it ends up on dom0.
I don't understand VLANs.  Do I need something set in the switch/router upstream for it to work?
Or, is there some other way to get traffic routed to the VM.  AT this point, I'm happy to just stick a rule in iptables, or haproxy or something.

Below are the ifconfig results I end up with.  But I can't ssh into my VM.  When I try, I just end up on dom0.
Anyway, I'm beyond frustrated at this point.  This really should be easy, shouldn't it?  What am I missing?
And of course I've already spent a lot of time on this, so now it's become pretty urgent.

Thanks for your help!

Liam

--
domU

ifconfig 
eth0      Link encap:Ethernet  HWaddr 32:4f:c9:ff:c6:7e  
          inet6 addr: fe80::304f:c9ff:feff:c67e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:20 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:1124 (1.0 KiB)
          Interrupt:23 

eth0:100  Link encap:Ethernet  HWaddr 32:4f:c9:ff:c6:7e  
          inet addr:162.x.x.16  Bcast:162.x.x.31  Mask:255.255.255.224
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          Interrupt:23 



dom0 (note: ignoring here references to eth1, which is bridged private network, not connected to NIC1 PIF)
ifconfig
eth0      Link encap:Ethernet  HWaddr 00:22:19:94:AD:82  
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:104642 errors:0 dropped:0 overruns:0 frame:0
          TX packets:88378 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:10505969 (10.0 MiB)  TX bytes:81383607 (77.6 MiB)

eth1      Link encap:Ethernet  HWaddr 00:22:19:94:AD:84  
          UP BROADCAST  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)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:56331 errors:0 dropped:0 overruns:0 frame:0
          TX packets:56331 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:146413759 (139.6 MiB)  TX bytes:146413759 (139.6 MiB)

vif2.0    Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF  
          UP BROADCAST RUNNING NOARP PROMISC  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:44 errors:0 dropped:49372 overruns:0 carrier:0
          collisions:0 txqueuelen:32 
          RX bytes:0 (0.0 b)  TX bytes:3011 (2.9 KiB)

vif2.1    Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF  
          UP BROADCAST RUNNING NOARP PROMISC  MTU:1500  Metric:1
          RX packets:34 errors:0 dropped:0 overruns:0 frame:0
          TX packets:245 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:32 
          RX bytes:1764 (1.7 KiB)  TX bytes:15795 (15.4 KiB)

vif6.0    Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF  
          UP BROADCAST RUNNING NOARP PROMISC  MTU:1500  Metric:1
          RX packets:20 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:32 
          RX bytes:844 (844.0 b)  TX bytes:0 (0.0 b)

vif6.1    Link encap:Ethernet  HWaddr FE:FF:FF:FF:FF:FF  
          UP BROADCAST RUNNING NOARP PROMISC  MTU:1500  Metric:1
          RX packets:14 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:32 
          RX bytes:836 (836.0 b)  TX bytes:712 (712.0 b)

xapi2     Link encap:Ethernet  HWaddr 00:22:19:94:AD:82  
          inet addr:162.x.x.16  Bcast:162.x.x.31  Mask:255.255.255.224
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:32 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1888 (1.8 KiB)  TX bytes:0 (0.0 b)

xenbr0    Link encap:Ethernet  HWaddr 00:22:19:94:AD:82  
          inet addr:162.x.x.13  Bcast:162.x.x.31  Mask:255.255.255.224
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:98504 errors:0 dropped:0 overruns:0 frame:0
          TX packets:46452 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:9428018 (8.9 MiB)  TX bytes:78700875 (75.0 MiB)

xenbr1    Link encap:Ethernet  HWaddr 00:22:19:94:AD:84  
          inet addr:10.0.0.1  Bcast:10.0.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING PROMISC MULTICAST  MTU:1500  Metric:1
          RX packets:1862 errors:0 dropped:0 overruns:0 frame:0
          TX packets:97 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:122676 (119.8 KiB)  TX bytes:8994 (8.7 KiB)



-- 
Liam Kirsher
PGP: http://liam.numenet.com/pgp/

_______________________________________________
Xen-users mailing list
[hidden email]
https://lists.xen.org/xen-users
Reply | Threaded
Open this post in threaded view
|

Re: Single NIC, multiple ip addresses

Simon Hobson-2
Liam Kirsher <[hidden email]> wrote:

> Need some help here, and I really hope this is the right place to ask!
> It seems like it should be simple.  I just need to have a single XenServer

Don't know anything about Xenserver and any differences from "plain Xen" in management ...

> , single NIC, with VMs having multiple different IP addresses.
> I have a XenServer 6.2 with two NICs: NIC0 and NIC1.  But I'm only getting connected to NIC0 from the ISP.
> The dom0 is set up with like this.
>
> address 162.x.x.13
> gateway 162.x.x.1
> netmask 255.255.255.24
> network 162.x.x.x0
>
> The ISP has given me additional ip addresses to use in the same subnet for a couple of VMs.
>
> I'm using XenCenter.  What I think I need to do and have tried, is
> 1. Create a Network (calling it "VLAN 100") on dom0 using XenCenter, attached to NIC 0, with VLAN setting (I'm using 100, but it seems arbitrary).

OK, there's your first mistake - unless you have a rather unusual setup then you do not need VLANs and your networking will not work if you try.

To achieve what you want is simple :

Define a bridge :
auto br0
iface br0 inet static
  bridge_ports eth0
  address 162.x.x.13
  netmask 255.255.255.24
  gateway 162.x.x.1

(I think you already have this)

That will get your host online, plus it will create you a bridge (virtual network switch) you can connect your DimUs to.

Now in your DomU config, define one virtual NIC connected to that bridge. In the DOmU itself, configure the NIC to have a fixed address as provided by your ISP - basically configure it as though it was a standalone machine connected to the ISP (the Dom0 doesn't really play any part in the networking other than to run the bridge).


_______________________________________________
Xen-users mailing list
[hidden email]
https://lists.xen.org/xen-users