Fedora Linux Support Community & Resources Center
  #1  
Old 18th June 2010, 10:48 PM
mdeggers Offline
Registered User
 
Join Date: Apr 2005
Posts: 14
linuxfedorafirefox
Trouble automating IP aliases

* Introduction

My system is F13 (upgraded from F11) with all of the latest patches
available. I haven't gone through and combined all of the rpmnew
configuration files, but none of them seem to address networking.

I'm trying to get subinterfaces (secondary IP addresses) to work in
Fedora 13. So far, I have been able to configure them on the command
line, but not to get them to persist on booting.

My base address for the NIC is: A.B.C.254. It is statically assigned.

* Question

Why can I not get any of the automated mechanisms to assign NIC
aliases? Here are the things I've tried:

* Using system-config-network with eth0:n as a nickname

Using system-config-network, I copied the existing interface and made
the following changes:

1. IP address changed
2. Device nickname as eth0:n
3. Activate device when parent device activates
4. Device Alias number n (where n is 0 or 1)
5. Added to default profile

Upon saving, this resulted in two files being created (ifcfg-eth0:0
and ifcfg-eth0:1). However, these could not be activated by doing
./ifup eth0:0 in the /etc/sysconfig/network-scripts directory.

* By hand using ifcfg-eth0:n

Editing the files based on several web pages to reduce the options
configured in the aliases produced the following file format:

DEVICE: eth0:n
IP_ADDRESS: A.B.C.n
NETMASK: 255.255.255.0
NETWORK: A.B.C.0

Using these files gave the same results as the system-config-network
files. The interfaces failed to appear on an ifconfig -a listing.

* Using system-config-network with ethn as a nickname

Using system-config-network, I copied the existing interface and made
the following changes:

1. IP address changed
2. Device nickname as ethn
3. Activate device when parent device activates
4. Device Alias number n (where n is 0 or 1)
5. Added to default profile

Upon saving, this resulted in two files being created (ifcfg-eth1
and ifcfg-eth2). When these were activated, they overwrote the
existing IP address for eth0. The result was that eth0 now had the IP
address listed in the ifcfg-eth2 file.

* By hand using ifcfg-ethn

I created the appropriate files by hand, with reduced configuration
options. Upon using ./ifup ethn from within the
/etc/sysconfig/network-scripts, the IP address of eth0 was replaced by
the IP address given in ethn.

* Using rc.local

I then tried modifying /etc/rc.local to contain the following lines:

/sbin/ifconfig eth0:0 A.B.C.n netmask 255.255.255.0 up
/sbin/ifconfig eth0:1 A.B.C.m netmask 255.255.255.0 up

This failed to result in eth0:0 or eth0:1 being available on reboot.

* Command line per reboot

This is the only option that seems to work. As root after each reboot
I can do the following:

/sbin/ifconfig eth0:0 A.B.C.n netmask 255.255.255.0 up
/sbin/ifconfig eth0:1 A.B.C.m netmask 255.255.255.0 up

This results in two aliases that are visible (and ping-able) as shown
by ifconfig -a.

[root@phoenix ~]# ifconfig eth0:0 A.B.C.253 netmask 255.255.255.0 up
[root@phoenix ~]# ifconfig eth0:1 A.B.C.252 netmask 255.255.255.0 up
[root@phoenix ~]# ifconfig -a
eth0 Link encap:Ethernet HWaddr 00:07:E9:00:DB:84
inet addr:A.B.C.254 Bcast:A.B.C.255 Mask:255.255.255.0
inet6 addr: fe80::207:e9ff:fe00:db84/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:640656 errors:2 dropped:0 overruns:0 frame:2
TX packets:413185 errors:30 dropped:0 overruns:0 carrier:30
collisions:0 txqueuelen:1000
RX bytes:847804784 (808.5 MiB) TX bytes:34830037 (33.2 MiB)

eth0:0 Link encap:Ethernet HWaddr 00:07:E9:00:DB:84
inet addr:A.B.C.253 Bcast:A.B.C.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

eth0:1 Link encap:Ethernet HWaddr 00:07:E9:00:DB:84
inet addr:A.B.C.252 Bcast:A.B.C.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

How do I get this result automatically for every reboot?

Thanks for any info.
Reply With Quote
  #2  
Old 19th June 2010, 10:12 AM
stevea Offline
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,849
linuxfedorafirefox
Re: Trouble automating IP aliases

There are two different ways you may be trying to implement this.

One is using the vconfig command to create a vlan 'device' on the specified interface. The other is using the "ip addr add dev eth0 A.B.C.42 [label eth0.1]" type command to create a second IP address on the same interface. These are two similar but different things.

The redhat 'ifup' ifdown' scripts can handle VLANs but have no facility for just assigning another IP address.
Here is a brief discussion on setting up a VLAN using the RH style scripts.
http://www.cyberciti.biz/tips/howto-...work-vlan.html
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe
Reply With Quote
  #3  
Old 19th June 2010, 09:54 PM
mdeggers Offline
Registered User
 
Join Date: Apr 2005
Posts: 14
linuxfedorafirefox
Re: Trouble automating IP aliases

Thanks for the reply.

Unfortunately my home switch does not support 801.Q (VLANs). This is why I need to use secondary addresses or IP aliases (interface:n) instead of sub-interfaces (interface.n).

The aliases work fine when configured manually after booting, but I have not been able to discover a way to have these aliases come up automatically after a reboot.

I'm setting up aliases in lieu of running different ports for the same service. I'm working on some documentation for Tomcat clustering, load balancing, and web application farm deployment. In order to accomplish this, I can run different ports for the same service, use IP aliases, or run separate machines. Using IP aliases most closely mimics a production environment with multiple machines.

I could probably set up a "router on a stick", tweak iptables, and either accept RIP or set static routes in my switch, but I'd like to avoid all of that if possible.

Thanks again though . . .
Reply With Quote
  #4  
Old 29th June 2010, 07:21 PM
michael.wegemer Offline
Registered User
 
Join Date: Aug 2008
Posts: 4
linuxfedorafirefox
Re: Trouble automating IP aliases

I am experiencing exactly the same issue. When issuing the ifconfig .... up commands I get error messages when the address is already assigned. I would suggest the following:

1. Issue "chkconfig NetworkManager off" as root to disable network mangler
2. Set the devices NOT to start at boot
3. In rc.local put the commands that you already have
ifconfig eth0 ... up
ifconfig eth0:1 ... up
I did not need the ifconfig -a

Note that I did not use the :0 for the first interface. When I had :0 it did not start.

These changes worked for me. I hope they help you.
Reply With Quote
  #5  
Old 29th June 2010, 08:27 PM
mdeggers Offline
Registered User
 
Join Date: Apr 2005
Posts: 14
linuxfedorafirefox
Re: Trouble automating IP aliases

I think that's probably the only way.

1. Turn off network manager.
2. Make sure the interfaces don't come up automatically
3. Run the ifconfig command in /etc/rc.local

This will cause problems with other automated services that depend on the network being up.

I was hoping I could have a profile for using IP aliases and another profile for normal runs. This doesn't appear to be possible. I should probably file a bug against NetworkManager.

Thanks for your comments
Reply With Quote
  #6  
Old 30th June 2010, 09:35 AM
David Becker Offline
Registered User
 
Join Date: Feb 2006
Posts: 780
linuxfedorafirefox
Re: Trouble automating IP aliases

Disable NetworkManager.
Install "bridge-utils".

ifcfg-eth0:

BRIDGE=lanbr0
DEVICE=eth0
HWADDR=<WHATEVERITIS>
BOOTPROTO=none
TYPE=Ethernet
ONBOOT=yes

ifcfg-lanbr0:

DEVICE=lanbr0
TYPE=Bridge
BOOTPROTO=dhcp
ONBOOT=yes

ifcfg-lanbr0:1

DEVICE=lanbr0:1
TYPE=Bridge
BOOTPROTO=static
IPADDR=<whatever>
NETMASK=<whatever>
ONBOOT=yes

etc.. You could also have setup lanbr0 with a static IP address.

BTW: It's "IPADDR" and not "IP_ADDR".

David
Reply With Quote
Reply

Tags
network, persistent

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with automating some terminal commands Enigma 2100 Using Fedora 3 8th December 2006 07:53 PM
Automating the keyring prdufresne Servers & Networking 16 6th November 2006 10:57 PM
Automating User Additions rob2000007 Using Fedora 6 24th October 2005 09:29 PM
Automating tasks cutesneakers Using Fedora 2 22nd July 2005 04:21 PM
Automating SCP between two remote Hosts? Quella Using Fedora 7 20th May 2005 09:27 AM


Current GMT-time: 12:21 (Tuesday, 23-09-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat