double ip address on the same ethernet card: is it possible?
Dear all, I need some help to configure my net configuration using ethernet card with SUSE 9.0 Pro on a laptop. I have set up correctly the card with ip, dns and all the stuff, and connection works : but now I would like to ADD a new configuration on the same card but with different parameters after some works have been done in my workplace and I cannot use the same ip address (and all other parameters) on different floors and sections of the building. What do I have to do? Can I follow the YAST configuration wizard or do I have to make some set up in order to have a double ip and make the machine automatically choose the ip? Thanx to all LM
Have you tried Yast Profile manager? It allows you to switch configurations with a couple of mouse clicks... JErry On Thu, 2004-05-13 at 15:38, Luca Mollica wrote:
Dear all,
I need some help to configure my net configuration using ethernet card with SUSE 9.0 Pro on a laptop. I have set up correctly the card with ip, dns and all the stuff, and connection works : but now I would like to ADD a new configuration on the same card but with different parameters after some works have been done in my workplace and I cannot use the same ip address (and all other parameters) on different floors and sections of the building. What do I have to do? Can I follow the YAST configuration wizard or do I have to make some set up in order to have a double ip and make the machine automatically choose the ip?
Thanx to all
LM
add a virtual ethernet card.
i.e: if your card is eth0 create a new card with eth0:0 and the new
address...
--- Luca Mollica
Dear all,
I need some help to configure my net configuration using ethernet card with SUSE 9.0 Pro on a laptop. I have set up correctly the card with ip, dns and all the stuff, and connection works : but now I would like to ADD a new configuration on the same card but with different parameters after some works have been done in my workplace and I cannot use the same ip address (and all other parameters) on different floors and sections of the building. What do I have to do? Can I follow the YAST configuration wizard or do I have to make some set up in order to have a double ip and make the machine
automatically choose the ip?
Thanx to all
LM
-- Check the headers for your unsubscription address For additional commands send e-mail to suse-linux-e-help@suse.com Also check the archives at http://lists.suse.com Please read the FAQs: suse-linux-e-faq@suse.com
===== Riccardo G. Facchini
From: Luca Mollica [mailto:luca_mollica@virgilio.it]
I have set up correctly the card with ip, dns and all the stuff, and connection works : but now I would like to ADD a new configuration on the same card but with different parameters after some works have been done in my workplace and I cannot use the same ip address (and all other parameters) on different floors and sections of the building. What do I have to do? Can I follow the YAST configuration wizard or do I have to make some set up in order to have a double ip and make the machine automatically choose the ip?
I did this, but only for an IP in the same network as the first one. I found it easier to setup editing the file /etc/sysconfig/network/ifcfg-ehtx where x is the number of the interface (probably 0 for yours unless you have more than one card). Mine looks like this... BOOTPROTO='static' BROADCAST='192.168.1.255' IPADDR='192.168.1.3' IPADDR_1='192.168.1.200' ->>> adds the address to the card IPADDR_2='192.168.1.201' ->>> adds another address MTU='' NETMASK='255.255.255.0' NETWORK='192.168.1.0' REMOTE_IPADDR='' STARTMODE='onboot' UNIQUE='' As this file defines a network for the interface I think it may prove more difficult if your addresses are not on the same network (e.g. 192.168.1.23 and 192.168.21.44). I think you'll have to make sure the routing table is properly setup for it to work. I have also tested things before commiting them to this file by using the following syntax on ifconfig to apply an additional address dynamically (it'll be lost after the next reboot or if you down then up the interface)... #> ifconfig eth0:1 192.168.1.200 HTH Damon
On Thu, 2004-05-13 at 10:28, Damon Jebb wrote:
From: Luca Mollica [mailto:luca_mollica@virgilio.it]
I have set up correctly the card with ip, dns and all the stuff, and connection works : but now I would like to ADD a new configuration on the same card but with different parameters after some works have been done in my workplace and I cannot use the same ip address (and all other parameters) on different floors and sections of the building. What do I have to do? Can I follow the YAST configuration wizard or do I have to make some set up in order to have a double ip and make the machine automatically choose the ip?
I did this, but only for an IP in the same network as the first one.
I found it easier to setup editing the file
/etc/sysconfig/network/ifcfg-ehtx
where x is the number of the interface (probably 0 for yours unless you have more than one card).
Mine looks like this...
BOOTPROTO='static' BROADCAST='192.168.1.255' IPADDR='192.168.1.3' IPADDR_1='192.168.1.200' ->>> adds the address to the card IPADDR_2='192.168.1.201' ->>> adds another address MTU='' NETMASK='255.255.255.0' NETWORK='192.168.1.0' REMOTE_IPADDR='' STARTMODE='onboot' UNIQUE=''
In /etc/sysconfig/network find ifcfg-eth0 and make copies like so: ifcfg-eth0 ifcfg-eth0:0 ifcfg-eth0:1 Modify :0 and :1 , as many others as you need, with the appropriate information based on subnet, etc. and rcnetwork reload, or restart. This will give you what is referred to as IP aliasing; multiple IP/masks on the one interface. You can figure out what info to put in each based on the original. -- Brad Shelton On Line Exchange http://www.ole.net Phone: 313-526-1111 Fax: 313-526-3333
On Thu, May 13, 2004 at 04:11:02PM -0400, Brad Shelton wrote:
On Thu, 2004-05-13 at 10:28, Damon Jebb wrote:
From: Luca Mollica [mailto:luca_mollica@virgilio.it]
Mine looks like this...
BOOTPROTO='static' BROADCAST='192.168.1.255' IPADDR='192.168.1.3' IPADDR_1='192.168.1.200' ->>> adds the address to the card IPADDR_2='192.168.1.201' ->>> adds another address MTU='' NETMASK='255.255.255.0' NETWORK='192.168.1.0' REMOTE_IPADDR='' STARTMODE='onboot' UNIQUE=''
In /etc/sysconfig/network
find ifcfg-eth0 and make copies like so:
ifcfg-eth0 ifcfg-eth0:0 ifcfg-eth0:1
Modify :0 and :1 , as many others as you need, with the appropriate information based on subnet, etc. and rcnetwork reload, or restart.
This will give you what is referred to as IP aliasing; multiple IP/masks on the one interface.
You can figure out what info to put in each based on the original.
This method has been deprecated in SuSE since (I believe) version 8.0 in favor of the first one. More in manpage of ip(8) and ifup(8). Regards, -Kastus
This method has been deprecated in SuSE since (I believe) version 8.0 in favor of the first one. More in manpage of ip(8) and ifup(8).
Kastus, before trying to configure the double ip connection, which one do you mean by "the first one" ? Mayb do you mean Riccardo Facchni's advice to add a virtual ethernet card with eth0:0 ? Anyway, I will check for other advices in manpages .... LM
Regards, -Kastus
From: Luca Mollica before trying to configure the double ip connection, which one do you mean by "the first one" ? Mayb do you mean Riccardo Facchni's advice to add a virtual ethernet card with eth0:0 ?
Luca, I believe that he was referring to the method of creating virtual interfaces that I posted, where IP aliases are created in the ifcfg-eth0 file, not separate files. I have read else where (possibly on this group, try a search) that the other method has some problems and this is the preferred one. Sorry, I don't recall where. To me deprecated means that although it works (the eth0:0 method) a newer, preferred method has been implemented (the one I posted). Having said this you may prefer to use the method recommended by Riccardo Facchni as it will allow you to define all parameters to meet your needs, not just the IP of the new interface. I would try both and see which works best for you and bear in mind that deprecated (to me) means that there is the potential for the method to become unsupported (i.e. not work) in the future. Regards, Damon
--- Damon Jebb <list at damonjebb dot net> wrote:
From: Luca Mollica before trying to configure the double ip connection, which one do you mean by "the first one" ? Mayb do you mean Riccardo Facchni's advice to add a virtual ethernet card with eth0:0 ?
Luca,
I believe that he was referring to the method of creating virtual interfaces that I posted, where IP aliases are created in the ifcfg-eth0 file, not separate files. I have read else where (possibly on this group, try a search) that the other method has some problems and this is the preferred one. Sorry, I don't recall where. To me deprecated means that although it works (the eth0:0 method) a newer, preferred method has been implemented (the one I posted).
Having said this you may prefer to use the method recommended by Riccardo Facchni as it will allow you to define all parameters to meet your needs, not just the IP of the new interface. I would try both and see which works best for you and bear in mind that deprecated (to me) means that there is the potential for the method to become unsupported (i.e. not work) in the future.
Regards,
Damon
[snip] I agree that the virtual interface method that i suggested is deprecated, but bear in mind that "potential for the method to become unsupported (i.e. not work) in the future." doesn't mean it will happen in the near future (i.e. less than an year). Check Cisco routers, they've been using it for years. Of course Cisco is not OS and is not Linux.... ;-) I'm not sure about what problems Damon refers to; I'll have to investigate. I myself I'm using the trick at a home box I have for experimentation, and it works perfectly well. I have a home IP range different from the office IP range, and my office laptop has a fixed IP address I don't want to change when I get home... so I added a virtual IP address to the home box I refer to that mimics the SMB box I have in the office... this way I was able to "feel" at "office" when I'm home... ===== Riccardo G. Facchini
From: Riccardo Facchini
I agree that the virtual interface method that i suggested is deprecated, but bear in mind that "potential for the method to become unsupported (i.e. not work) in the future." doesn't mean it will happen in the near future (i.e. less than an year). Check Cisco routers, they've been using it for years. Of course Cisco is not OS and is not Linux.... ;-)
Agreed, I just think it is a consideration that one has to make when choosing a solution.
I'm not sure about what problems Damon refers to; I'll have to investigate. I myself I'm using the trick at a home box I have for experimentation, and it works perfectly well. I have a home IP range different from the office IP range, and my office laptop has a fixed IP address I don't want to change when I get home... so I added a virtual IP address to the home box I refer to that mimics the SMB box I have in the office... this way I was able to "feel" at "office" when I'm home...
I did not need to use a completely different network when setting up mine, and this may be a reason to use the deprecated method. I don't know. I like the newer method for the simple reason; that it is all in a single file and therefore slightly easier to manage (IMHO). I'm not sure whether this method is supported by YaST though. Although I see information about the virtual interfaces when I go into the relevant section I cannot find any way to add more virtual interfaces or change the settings of the existing ones. Damon
Luca Mollica wrote:
This method has been deprecated in SuSE since (I believe) version 8.0 in favor of the first one. More in manpage of ip(8) and ifup(8).
Kastus, before trying to configure the double ip connection, which one do you mean by "the first one" ? Mayb do you mean Riccardo Facchni's advice to add a virtual ethernet card with eth0:0 ? Anyway, I will check for other advices in manpages ....
LM
Regards, -Kastus
IP-Aliasing was deprecated as an option way back, but it's still available, e.g "ifconfig eth0:0 192.168.10.1" "ifconfig eth0:1 10.0.0.1". From /usr/src/linux-2.6.6-mm2/Documentation/networking/alias.txt IP-Aliasing: ============ IP-aliases are additional IP-addresses/masks hooked up to a base interface by adding a colon and a string when running ifconfig. This string is usually numeric, but this is not a must. IP-Aliases are avail if CONFIG_INET (`standard' IPv4 networking) is configured in the kernel. o Alias creation. Alias creation is done by 'magic' interface naming: eg. to create a 200.1.1.1 alias for eth0 ... # ifconfig eth0:0 200.1.1.1 etc,etc.... ~~ -> request alias #0 creation (if not yet exists) for eth0 The corresponding route is also set up by this command. Please note: The route always points to the base interface. o Alias deletion. The alias is removed by shutting the alias down: # ifconfig eth0:0 down ~~~~~~~~~~ -> will delete alias o Alias (re-)configuring Aliases are not real devices, but programs should be able to configure and refer to them as usual (ifconfig, route, etc). o Relationship with main device If the base device is shut down the added aliases will be deleted too. Regards Sid. -- Sid Boyce .... Hamradio G3VBV and keen Flyer Linux Only Shop.
Another way to temporary add more IP's to the same interface:
ip addr add
participants (8)
-
Brad Shelton
-
Damon Jebb
-
Doomtrooper
-
Jerome R. Westrick
-
Kastus
-
Luca Mollica
-
Riccardo Facchini
-
Sid Boyce