Gentoo Archives: gentoo-user

From: Grant <emailgrant@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] IP aliasing problem
Date: Wed, 06 Oct 2010 22:18:20
Message-Id: AANLkTikwapbW+SPcUSEk3Bxfd-ykX7otG34fMmsdd=5J@mail.gmail.com
In Reply to: Re: [gentoo-user] IP aliasing problem by Stroller
1 >> ...I have 5 usable IPs from my host and I've defined 2 of them in /etc/conf.d/net like this:
2 >
3 >>
4 >> config_eth0=(
5 >>        "1.2.3.1 netmask 255.255.255.0"
6 >>        "1.2.3.2 netmask 255.255.255.0"
7 >> )
8 >>
9 >> My apache2 config is not working as expected and I think its due to a
10 >> networking problem because eth0:1 reports no RX or TX stats:
11 >>
12 >> # ifconfig
13 >> eth0      Link encap:Ethernet  HWaddr [removed]
14 >>          inet addr:1.2.3.1  Bcast:[removed]  Mask:255.255.255.0
15 >>          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
16 >>          RX packets:46047 errors:0 dropped:0 overruns:0 frame:0
17 >>          TX packets:65703 errors:0 dropped:0 overruns:0 carrier:0
18 >>          collisions:0 txqueuelen:1000
19 >>          RX bytes:6131194 (5.8 MiB)  TX bytes:82568335 (78.7 MiB)
20 >>          Interrupt:40
21 >>
22 >> eth0:1    Link encap:Ethernet  HWaddr [removed]
23 >>          inet addr:1.2.3.2  Bcast:[removed]  Mask:255.255.255.0
24 >>          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
25 >>          Interrupt:40
26 >
27 > It's frustrating that you must conceal the IP addresses during a question like this, because it makes it harder to know whether you've misconfigured your host or just made a typo in transcription. It's probably clearer if you alter only the second octet of your IPs, and leave everything else otherwise intact.
28 >
29 > However... if you have 5 usable IPs then your subnet mask will not be 255.255.255.0 - it'll be 255.255.255.248. See http://krow.net/dict/subnet.html
30 > The broadcast address will also be affected. This is also known as a /29 subnet - IIRC you actually have 8 IPs assigned to you - one of them is used by the router, one of them is the broadcast, and the other is unused (the way 192.168.0.0 or 0.0.0.0 is normally unused).
31 >
32 > Since your router has an IP in the same subnet, you'll know this is all working when you can ping the addresses of your webserver (1.2.3.1 & 1.2.3.2) from the router.
33 >
34 > Alternatively, set up a second PC - e.g. your laptop - on the globally-addressable subnet, and try pinging from there.
35 >
36 > The normal situation with a home router is that it has a globally-addressable IP on it's "WAN" interface and a private IP (192.168.x.y) on its LAN interface. When you start using your globally-addressable IPs behind the router you usually need to tell it so, and I'm guessing you haven't done that.
37 >
38 > If your laptop is currently using 192.168.a.b with a default gateway of 192.168.0.1, then the packets will be sent to the router for routing. And if the router is in the default configuration usual for home users, it won't know there's a 1.2.3.z subnet on your LAN, and it'll be trying to route the packets out into the internet (and those poor little packets will probably get very confused when they reach your ISP and it sends them back again!).
39 >
40 > You can triple-home by setting eth0:2 to 192.168.c.d, and can (depending on your bridge/router configuration) continue to use private addresses for additional machines if you have more hosts on the LAN than you have globally-addressable IPs. Watch out for default gateway and DNS stuff! You'll probably want to give your laptop 1 private + 1 global IP whilst you're testing.
41 >
42 > If your router is a fully-configurable Linux box then say so, and someone will be able to point you in the right direction for this. It's been a long time since I messed with this. I'm still using an old Draytek Vigor here, and this is all done by checking a radio button and pasting IP addressy stuff into boxes in the web-based configurator. The router has to operate in bridging mode to do this - on a Linux router you need configure as a bridge and NOT as a router (or, I think, as both).
43 > http://www.google.com/search?q=bridge+5+usable+ips
44 >
45 > My initial reaction to your question was, "Oh, Grant, this is simple network stuff", but whilst writing this my memory has been roughly refreshed, and I realise it's really not terribly simple at all. I'm extremely rusty at all this, and I'm also very tired, so I'm not going to write any more right now.
46 >
47 > Stroller.
48
49 Thank you for taking the time to write Stroller. This has really got
50 my head spinning. First of all, you're right about the netmask. It
51 is 255.255.255.248. I didn't have a good understanding of what a
52 netmask is so I thought it would be smart to change it for a public
53 message.
54
55 The server is remote and hosted so I don't have any control over the
56 router or network. I've gone back and forth with the host but they
57 insist that everything is fine on their end.
58
59 I'm confused because I have in apache2 config:
60
61 <VirtualHost 1.2.3.1:443>
62 ...
63 SSLCertificateFile /etc/apache2/ssl/www.example1.com.crt
64 SSLCertificateKeyFile /etc/apache2/ssl/www.example1.com.key
65 ...
66 </VirtualHost>
67 <VirtualHost 1.2.3.2:443>
68 ...
69 SSLCertificateFile /etc/apache2/ssl/www.example2.com.crt
70 SSLCertificateKeyFile /etc/apache2/ssl/www.example2.com.key
71 ...
72 </VirtualHost>
73
74 But if I request https://1.2.3.2 or https://1.2.3.2:443, I'm presented
75 with an SSL cert that has www.example1.com for the Common Name. I
76 used openssl to verify that the Common Name for www.example2.com.crt
77 is www.example2.com.
78
79 My knowledge of networking is weak and I'm unsure of where to look for
80 the problem.
81
82 - Grant

Replies

Subject Author
Re: [gentoo-user] IP aliasing problem BRM <bm_witness@×××××.com>
[gentoo-user] Re: IP aliasing problem walt <w41ter@×××××.com>
Re: [gentoo-user] IP aliasing problem Michael Orlitzky <michael@××××××××.com>
Re: [gentoo-user] IP aliasing problem Stroller <stroller@××××××××××××××××××.uk>