Re: assigning multiple ip addresses to NIC on bootupm, how?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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@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@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@tregonwell root]# ifconfig eth0:1 192.168.0.140
[root@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.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux