Ip-aliasing how do you make it stick?

Hi all,

Over the last week I have spend many hours tying to set up two virual hosts using SSL on my Development server. I initially got it working using ip-based virtual hosting, but had to revert back to name-based instead. The problem I had was setting up the alias Ip address for my second domain. I didn’t have any problems using ifconfig to set it up and test the setup but couldn’t find the actual config file to put the ifconfig commands in so the aliased address would be there after reboot. I want to use ip-based virtual hosting as it will be the route I will need to go when I publish bothe of these sites. Below are the ifconfig commands which do work, but where do I put them to make them work after a reboot? Or is there a different way to add more than one ip alias to a single network card?

ifconfig eth0:0 192.1.1.3
rout add -host 192.1.1.3 dev eth0:0

I found this referenced in more than three different tutorials on the web and they all point to a file in /etc/rc.d/rc.local. I can’t find it in SUSE 11. Is it even done that way on Suse 11?

Thanks again in advance for any help.
jtaitt

You can set up aliases in YaST > Network Devices > Network Settings > Edit. You can also directly edit /etc/sysconfig/network/ifcfg-ethX, but you have to know the format of the alias entry, so add one using YaST and see what it looks like for future reference.

Thanks again for all of your help in all three of my threads.

To be honest, I thought I tried to add an ip-alias in Yast but couldn’t get access to the part of the screen that lets you enter the alias. It’s wasn’t available. I did find the file you suggested and added some entries I found in a google search and they didn’t work. At least I couldn’t see them when I used the ifconfig command to verify if they were there. I’ll go back and try to see why I can’t create aliases in Yast and get back with you on this.

Thanks,
jtaitt

Hi again ken_yap,

I took a look at the Network Settings in YAST and as I remember, the part of the form to add aliases to is not accessible. No matter what I tried to do it would not allow me to add an alias via the GUI. I did find some info about manually adding an alias in the conf file. After I added commands for the aliass I rebooted and checked YAST again and found what looks like a valid entry in the alias form even though it is still locked. I tried to look for the new alias using ifconfig but it doesn’t showup. One thing I did notice in the document I read about setting up the alias manually said something about under certain circumstances ifconfig would no longer work and to use ip. Ip is a new command for me and I tried to use some of the flags and optons from it’s man page but still couldn’t see the new alias. All to say, it looks like it is there, but I don’t know how to verify it. Do you have any suggestions?

Of course it’s accessible. I just tried it this morning.

YaST > Network Devices > Network Settings > Overview > Select Device > Edit.

One possibility it’s not accessible is you are using a dynamic address from your router. In which case you should switch to a static address. If you hope to run a webserver on that machine you’ll need a static address anyway. Not much fun when a webserver’s address is at the whim of the DHCP server in the router.

I’m sure I’m using a static address but I’ll go back and check it out again and get back to you. One question though, once it is working will I be able to see the aliased address using ifconfig? As I stated above, on the man page I was reading, I believe it was for ifcfg made some kind of comment about it not working and having to use ip.

I went back and checked my router and the address is definitely static as well as how it’s defined on the network Setting Address dialog. But I’m sorry to say I still don’t have access to the ip-alias part of the form. I know it doesn’t make sense, if I could give you a screen print here I would show you. As I stated above, I entered some commands into /etc/sysconfig/network/ifcfg-eth0 and the results display in the ip-alias form even though I can’t edit them.

ifcfg-eth0:

BOOTPROTO=‘static’
BROADCAST=’’
ETHTOOL_OPTIONS=’’
IPADDR=‘192.1.1.108/24’
MTU=‘1492’
NAME=‘RTL-8139/8139C/8139C+’
NETMASK=’’
NETWORK=’’
REMOTE_IPADDR=’’
STARTMODE=‘ifplugd’
USERCONTROL=‘no’
IFPLUGD_PRIORITY=‘20’
BOOTPROTO_1=‘auto’
BROADCAST_1=’’
ETHTOOL_OPTIONS_1=’’
IPADDR_1=‘192.1.1.208/24’
MTU_1=‘1492’
NAME_1=‘RTL-8139/8139C/8139C+’
NETMASK_1=’’
NETWORK_1=’’
REMOTE_IPADDR_1=’’
STARTMODE_1=‘off’
USERCONTROL_1=‘no’
IFPLUGD_PRIORITY_1=‘20’
PREFIXLEN_1=’’
LABEL_1=‘1’

Ip-Alias listing:

Alias Name = 1
IP Address = 192.1.1.208
Netmask = 255.255.255.0

Looks like its working but I can’t prove it. The alias eth0:1 does not show up when I use ifconfig. I’ll re-configure my Virtual Host setup back to an ip-based setup and see if it works. I assume there is a separate listing in the Software Management module in YAST to delete the Network Setting Module. Perhaps it’s corrupted in some way. If all else fails I’ll try re-installing it and re-configuring my Network stuff again.

I’ll be gone the rest of the day but will post my finding as soon as I can get back to it.

Again, many thanks

Is your firewall up and running?

I had some issues regarding not being able to do some things with the IPs configurations if the iface was not set to one zone. (don’t remember if was ip aliases).

Cheers

Looks like its working but I can’t prove it. The alias eth0:1 does not show up when I use ifconfig.

Forget about ifconfig and use ip instead.

I checked and the firewall is set to the External Zone. One other discovery I made though is I have Suse 11 installed on both my Laptop as well as my Server. All of the testing and setup I’m doing first on my Laptop and then applying it to the server if it proves to be working properly. I just checked my server which I haven’t set up virtual hosting yet until I have the ip-alasing figured out first, has the ip-alias screen in YAST inaccessible also. I’m really confused now, it looks like they both are that way from the initial installation.

Probably your DIY edits to /etc/sysconfig/network/ifcfg-eth0 confused YaST. As I recall, the alias entry just adds two lines:

IPADDR_foo=…
and one other ending in foo that I forget. foo is the name of the alias, so the interface will show as eth0:foo

FYI this is the whole of my ifcfg-eth0 before adding an alias. Yours looks far too complicated.

BOOTPROTO=‘static’
BROADCAST=’’
ETHTOOL_OPTIONS=’’
IPADDR=‘xx.xx.xx.xx/24’
MTU=’’
NAME=‘Some driver name’
NETWORK=’’
REMOTE_IPADDR=’’
STARTMODE=‘auto’
USERCONTROL=‘no’

jengelh,

I would love to use ip, I have tried to read the man pages for it and haven’t come up with any good results. I don’t know if it is because I’m not using the correct command or the ip-alias is not there. It would be really valuable to me if you could give me a couple of example ip commands which would display the alias if it exists.

Thanks,
jtaitt

Nothing easier than that…


ip a

(or /sbin/ip if your $PATH has been decimated by suse…)
If it is set up, i.e. the kernel knows about it, you will see it.

It occurs to me that your ifcfg-eth0 specifies assign address on activation (startmode=ifplugd). That probably means it’s not fully static from boot and isn’t conducive to having an alias.

Thanks again guys for the input. I did discover if you go into Network Settings in Yast and click on the global tab, and change the radio button from User Controlled with NetworkManager to Traditional Method with ifup and then save your changes. When you come back into Network settings again and try to add an ip-alias, believe it or not I can now enter aliases. And they work. Now I have some kind of issues with my network connection now it is really slow like there is a conflict somewhere.

ken_yap you mentioned you had access to the ip-alias dialog. What version of Suse and KDE are you running and which one of the options in the global tab I mentioned above do you have selected?

Jim

OpenSUSE 11.0, KDE4. Static IP address using ifup.

Thanks ken, I finally got mine running on my server and laptop with a Wired connection, but I’m not having any luck yet with the Wireless card which is an older Atheros card. It worked fine until I started using ifup and Kinternet rather than NetworkManager. I need to find a Madwifi Driver that will work with that card and will handle WPA encryption. I had one working in Suse 10.3 but not sure if it used ifup or not?

For what it’s worth, I’ve had greater success with my Atheros cards and WPA by using ndiswrapper. I did have madwifi and wpa working together some time ago, but I seem to recall that I had to do source compiles of madwifi and then compile wpa against the madwifi source.

Paul

Thanks to all again for the input, I now have the ip-aliases working on both machines both wired and wireless connections.

I also have two separate virtual hosts up and running each with their own separate SSL certificates… Also the idea of using the ndiswrapper is probably something I need to try even though I found a madwifi driver that works but is not as clean as I would like…