assigning multiple ip addresses to NIC on bootupm, how?

Chris Lowth chris at lowth.com
Mon Jul 11 08:08:16 UTC 2005



Jeff Vian wrote:

>>Or simply add the commands to /etc/rc.local
>>    
>>
>
>That will not work for his needs.  rc.local is the last script run and
>he needs the interfaces active before httpd starts. 
>
>  
>
Yes: it will work - it's exactly what I do on my servers.

And .. No, he doesnt need the logical interfaces active before httpd runs

Given that the OP currently works by running the commands in an 
interactive shell after bootup and makes no comment about having to 
restart Apache, this suggests that he is not using IP addresses in his 
"Listen" options in httpd.conf - which means that Apache is listening on 
IP 0.0.0.0 ("all") which in turn means that adding IPs to interfaces 
after the event will indeed work just fine. The "interfaces must be 
active" point is only an issue if Apache is bound to specific IPs via 
the "Listen" statement - and it appears that this is not the case for 
the OP.

It's easy to check.. if "netstat -nta" shows no specific IP address 
against the "LISTEN" entry for port 80, then the rc.local route will 
work fine - whether it's "best practice" is another matter.

Here's the trace of an actual test...

[root at tregonwell root]# ifconfig
eth0      Link encap:Ethernet  HWaddr << CUT >>
          inet addr:192.168.0.14  Bcast:192.168.0.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:148 errors:0 dropped:0 overruns:0 frame:0
          TX packets:180 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:14384 (14.0 Kb)  TX bytes:46289 (45.2 Kb)
          Interrupt:3

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:10 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:700 (700.0 b)  TX bytes:700 (700.0 b)

[root at tregonwell root]# netstat -nta | grep :80 | grep LISTEN
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN
tcp        0      0 :::80                   :::*                    LISTEN
[root at tregonwell root]# ifconfig eth0:1 192.168.0.140
[root at tregonwell root]# telnet 192.168.0.140 80
Trying 192.168.0.140...
Connected to 192.168.0.140.
Escape character is '^]'.
GET /XXXXXX HTTP/1.0

HTTP/1.1 404 Not Found

------ cut -----

Chris

--
http://www.lowth.com/rope - iptables match module scripting
   language for controlling P2P and other high-level protocols.




More information about the fedora-list mailing list