Hi,
You need to issue two commands:
/sbin/ifconfig eth0:0 xxx.xxx.xxx.xxx /sbin/route add -host xxx.xxx.xxx.xxx dev eth0
For example:
/sbin/ifconfig eth0:0 172.16.1.199 /sbin/route add -host 172.16.1.199 dev eth0
You can even assign multiple aliases to one NIC (One of my servers has about 10 ip addresses):
For example:
/sbin/ifconfig eth0:0 172.16.1.199 /sbin/route add -host 172.16.1.199 dev eth0
/sbin/ifconfig eth0:1 172.16.1.198 /sbin/route add -host 172.16.1.198 dev eth0
/sbin/ifconfig eth0:2 172.16.1.197 /sbin/route add -host 172.16.1.197 dev eth0
and so on.....
You should write an startup script to execute these commands at boot time, because after a reboot the aliases are forgotten.
Thom van der Boon E-Mail: Thom.van.der.Boon@vdb.nl
=====
Thom.H. van der Boon b.v. Havens 563 Jan Evertsenweg 2-4 NL-3115 JA Schiedam Tel.: +31 (0)10 4272727 Fax: +31 (0)10 4736620 E-Mail: info@vdb.nl Home Page: http://www.vdb.nl/
joao.c.medeiros@gmail.com 24.06.2005 00:28:01 >>>
Hi all,
I've been trying to add a second ip address to one of my network cards in my CentOS box. I've defined the alias on top of eth1 which has become eth1:1 with a different ip address.
I can ping the new ip address both from my linux box as well as from my Windoze desktop, however I can only access my Apache web server setup as a virtual host from within the Linux box. If I try to access it from the desktop I get an "Operation Timeout..." error.
I'm sure I missed out something really basic. Browsed Google and the CentOS mailing list (plus RH) and can't figure it out. Networking is not one of my best subjects... Someone care to shed some light or point me to a fairly decent link out there which covers this topic?
TIA, --JM
João Medeiros Linux User 381318
_______________________________________________ CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos
Am Fr, den 24.06.2005 schrieb Thom van der Boon um 0:34:
You need to issue two commands:
/sbin/ifconfig eth0:0 xxx.xxx.xxx.xxx /sbin/route add -host xxx.xxx.xxx.xxx dev eth0
For example:
/sbin/ifconfig eth0:0 172.16.1.199 /sbin/route add -host 172.16.1.199 dev eth0
No route setting needed. The aliased device is anyway handled over the real device.
You can even assign multiple aliases to one NIC (One of my servers has about 10 ip addresses):
For example:
/sbin/ifconfig eth0:0 172.16.1.199 /sbin/route add -host 172.16.1.199 dev eth0
/sbin/ifconfig eth0:1 172.16.1.198 /sbin/route add -host 172.16.1.198 dev eth0
/sbin/ifconfig eth0:2 172.16.1.197 /sbin/route add -host 172.16.1.197 dev eth0
and so on.....
You should write an startup script to execute these commands at boot time, because after a reboot the aliases are forgotten.
This isn't recommended this way.
Thom van der Boon
CentOS has native configuration ways to handle aliased devices. Either by running redhat-config-network (3.5) or system-config-network (4.1) and then choosing an aliased device or by hand: copying /etc/sysconfig/network-scripts/ifcfg-eth1 as ifcfg-eth1:0 ... ifcfg-eth1:1 ... and then changing the content of the ifcfg-eth0:X file regarding DEVICE name, IP data and HWADDR (MAC). A "service network restart" will bring up the new aliased device(s) together with the real ones. "ifconfig" shows eth0:X (X0number) and "ip addr ls" will show the additional IP(s) as part of the real device.
Alexander
I found what the problem is... I have Firestarter installed and If I turn it off I can access the web site with the ip alias. I wouldn't like to have to turn the firewall off. Any thoughts?
TIA, --JM
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of Alexander Dalloz Sent: 23 June 2005 23:56 To: CentOS mailing list Subject: Re: Betr.: [CentOS] Multiple IP Addresses in a single NIC
Am Fr, den 24.06.2005 schrieb Thom van der Boon um 0:34:
You need to issue two commands:
/sbin/ifconfig eth0:0 xxx.xxx.xxx.xxx /sbin/route add -host xxx.xxx.xxx.xxx dev eth0
For example:
/sbin/ifconfig eth0:0 172.16.1.199 /sbin/route add -host 172.16.1.199 dev eth0
No route setting needed. The aliased device is anyway handled over the real device.
You can even assign multiple aliases to one NIC (One of my servers has
about 10 ip addresses):
For example:
/sbin/ifconfig eth0:0 172.16.1.199 /sbin/route add -host 172.16.1.199 dev eth0
/sbin/ifconfig eth0:1 172.16.1.198 /sbin/route add -host 172.16.1.198 dev eth0
/sbin/ifconfig eth0:2 172.16.1.197 /sbin/route add -host 172.16.1.197 dev eth0
and so on.....
You should write an startup script to execute these commands at boot time,
because after a reboot the aliases are forgotten.
This isn't recommended this way.
Thom van der Boon
CentOS has native configuration ways to handle aliased devices. Either by running redhat-config-network (3.5) or system-config-network (4.1) and then choosing an aliased device or by hand: copying /etc/sysconfig/network-scripts/ifcfg-eth1 as ifcfg-eth1:0 ... ifcfg-eth1:1 ... and then changing the content of the ifcfg-eth0:X file regarding DEVICE name, IP data and HWADDR (MAC). A "service network restart" will bring up the new aliased device(s) together with the real ones. "ifconfig" shows eth0:X (X0number) and "ip addr ls" will show the additional IP(s) as part of the real device.
Alexander
-- Alexander Dalloz | Enger, Germany | GPG http://pgp.mit.edu 0xB366A773 legal statement: http://www.uni-x.org/legal.html Fedora Core 2 GNU/Linux on Athlon with kernel 2.6.11-1.27_FC2smp Serendipity 00:40:31 up 2 days, 8:54, load average: 0.44, 0.45, 0.35
Am Fr, den 24.06.2005 schrieb Joao Medeiros um 14:19:
I found what the problem is... I have Firestarter installed and If I turn it off I can access the web site with the ip alias. I wouldn't like to have to turn the firewall off. Any thoughts?
--JM
iptables isn't able to handle aliased device names (like eth0:0), so you will have to use IPs in your rules rather than device names (like -i eth0 -j ACCEPT).
Alexander
I've made the changes to my Firestarter rules as suggested by Alexander and I can now access my web server running as a virtual host from my desktop. Here's what I had to change:-
In my /etc/firestarter/user-pre file I've added an entry like:
# eth1:1 is the alias on top of eth1 $IPT -A INPUT -i eth1 -j ACCEPT
Thanks for your help folks.
--JM
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of Alexander Dalloz Sent: 24 June 2005 13:28 To: CentOS mailing list Subject: RE: Betr.: [CentOS] Multiple IP Addresses in a single NIC
Am Fr, den 24.06.2005 schrieb Joao Medeiros um 14:19:
I found what the problem is... I have Firestarter installed and If I turn it off I can access the web site with the ip alias. I wouldn't like to have to turn the firewall off. Any thoughts?
--JM
iptables isn't able to handle aliased device names (like eth0:0), so you will have to use IPs in your rules rather than device names (like -i eth0 -j ACCEPT).
Alexander
-- Alexander Dalloz | Enger, Germany | GPG http://pgp.mit.edu 0xB366A773 legal statement: http://www.uni-x.org/legal.html Fedora Core 2 GNU/Linux on Athlon with kernel 2.6.11-1.27_FC2smp Serendipity 14:25:57 up 2 days, 22:40, load average: 0.06, 0.14, 0.10
On Fri, 2005-06-24 at 13:19 +0100, Joao Medeiros wrote:
I found what the problem is... I have Firestarter installed and If I turn it off I can access the web site with the ip alias. I wouldn't like to have to turn the firewall off. Any thoughts?
TIA, --JM
I have never used firestarter ... but configure it to pass in port 80 from the new ip address :)
-----Original Message----- From: centos-bounces@centos.org [mailto:centos-bounces@centos.org] On Behalf Of Alexander Dalloz Sent: 23 June 2005 23:56 To: CentOS mailing list Subject: Re: Betr.: [CentOS] Multiple IP Addresses in a single NIC
Am Fr, den 24.06.2005 schrieb Thom van der Boon um 0:34:
You need to issue two commands:
/sbin/ifconfig eth0:0 xxx.xxx.xxx.xxx /sbin/route add -host xxx.xxx.xxx.xxx dev eth0
For example:
/sbin/ifconfig eth0:0 172.16.1.199 /sbin/route add -host 172.16.1.199 dev eth0
No route setting needed. The aliased device is anyway handled over the real device.
You can even assign multiple aliases to one NIC (One of my servers has
about 10 ip addresses):
For example:
/sbin/ifconfig eth0:0 172.16.1.199 /sbin/route add -host 172.16.1.199 dev eth0
/sbin/ifconfig eth0:1 172.16.1.198 /sbin/route add -host 172.16.1.198 dev eth0
/sbin/ifconfig eth0:2 172.16.1.197 /sbin/route add -host 172.16.1.197 dev eth0
and so on.....
You should write an startup script to execute these commands at boot time,
because after a reboot the aliases are forgotten.
This isn't recommended this way.
Thom van der Boon
CentOS has native configuration ways to handle aliased devices. Either by running redhat-config-network (3.5) or system-config-network (4.1) and then choosing an aliased device or by hand: copying /etc/sysconfig/network-scripts/ifcfg-eth1 as ifcfg-eth1:0 ... ifcfg-eth1:1 ... and then changing the content of the ifcfg-eth0:X file regarding DEVICE name, IP data and HWADDR (MAC). A "service network restart" will bring up the new aliased device(s) together with the real ones. "ifconfig" shows eth0:X (X0number) and "ip addr ls" will show the additional IP(s) as part of the real device.
Alexander
-- Alexander Dalloz | Enger, Germany | GPG http://pgp.mit.edu 0xB366A773 legal statement: http://www.uni-x.org/legal.html Fedora Core 2 GNU/Linux on Athlon with kernel 2.6.11-1.27_FC2smp Serendipity 00:40:31 up 2 days, 8:54, load average: 0.44, 0.45, 0.35
CentOS mailing list CentOS@centos.org http://lists.centos.org/mailman/listinfo/centos