IP Aliases: The YaST way and the "ip" way -- Are both slightly broken?
SUSE / openSUSEThis Forum is for the discussion of Suse Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,818
Rep:
IP Aliases: The YaST way and the "ip" way -- Are both slightly broken?
Environment: OpenSUSE Leap 15.2 (that upgrade to 15.3 is just around the corner). Apache 2.4.4 newly compiled. No error/warnings (remarkably clean session log).
I have three Apache 2.4.4 virtual hosts that are supposed to use addresses "192.168.13.20[0-2]". Initially, I created those using the dialog in YaST for adding additional addresses to a particular interface. Apache would not start, complaining about not being able to "bind a sock" (I don't recall the exact error message but it seemed to be address-related). I tried verifying that YaST had created them by issuing "ip addr" but no aliases. So... I deleted them in YaST.
Those aliases were then added using "ip address add 192.168.13.20N/24 dev eth0" and they actually show up when issuing "ip addr". I am unable to ping any of the three despite "ip" telling me that they're associated with "eth0". Using the deprecated "netstat", I cannot see any of those three addresses in a "LISTEN" state. (Which I didn't find surprising since Apache didn't start and there weren't any processes tied to those addresses.)
Just for grins, I created an address "192.168.13.234/24" using YaST. Then I grepped for that IP address under /etc. I found that, as expected, it had left information under /etc/sysconfig/network about the alias---something that "ip" didn't do when I grepped for one of the "aliases" I'd set up using that utility. Wierd. (Especially since "ip" is the new kid here to replace "ifconfig".) Also, the YaST-created alias showed up in netstat's output but NOT in ip's.
I decided to edit the ifcfg-eth0 file in /etc/sysconfig/network and duplicate the entry for the ".234" address and tweaked them so that I had ".200", ".201", and ".202". Then I jumped into YaST and verified that it "saw" the hand-edited aliases. It even accepted the ":" I put in the labels for the aliases (something that YaST itself would not allow in its add-an-address dialog). Thinking that the "ifcfg" files are, apparently, only getting read when the network layer (in my case "wicked") is bounced, I had systemctl do that even though I thought YaST did that step after you committed your changes. After that, "ip" sees the new YaST-approved aliases/labels as well.
On another forum I stumbled across while researching this, one of the frequent posters seemed to insist that "ip" was the True and Correct way to create aliases. If that's the case I'm just not sure how "ip"'s settings result in network changes that survive a reboot.
Question: Just what is the correct means of manipulating network addresses these days? YaST seems to leave the disk-based information that subsequent bootstraps and network restarts can use. AFAICT, "ip" just seems to tweak settings in memory. Is this akin to the days of a device like, say, a terminal server where you could "define" a setting (make it part of the non-volatile configuration) or "set" a setting (change it now in the in-memory configuration but lose that after a restart) so, essentially, YaST is doing the "define" but "ip" only does the "set"?
I look forward to reading other's experiences with this.
Just for grins, I created an address "192.168.13.234/24" using YaST. Then I grepped for that IP address under /etc. I found that, as expected, it had left information under /etc/sysconfig/network about the alias---something that "ip" didn't do when I grepped for one of the "aliases" I'd set up using that utility. Wierd. (Especially since "ip" is the new kid here to replace "ifconfig".) Also, the YaST-created alias showed up in netstat's output but NOT in ip's.
No, that is not 'wierd'. The 'ip' command is used to manage/configure network interfaces and routing rules on the fly. It does not write to configurations files, and is independent of any network management framework that may be in use.
On another forum I stumbled across while researching this, one of the frequent posters seemed to insist that "ip" was the True and Correct way to create aliases. If that's the case I'm just not sure how "ip"'s settings result in network changes that survive a reboot.
Likely you misunderstood. The ip command (and it's predecessor ifconfig) are ony used to report current network information, and can make changes on the fly. These changes are runtime only, and will not survive a reboot. Changes that need to be permanent are made via the active network management system (eg NetworkManager, systemd-networkd)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,818
Original Poster
Rep:
Quote:
Originally Posted by ferrari
Likely you misunderstood. The ip command (and it's predecessor ifconfig) are ony used to report current network information, and can make changes on the fly. These changes are runtime only, and will not survive a reboot. Changes that need to be permanent are made via the active network management system (eg NetworkManager, systemd-networkd)
That's sort of I came away with after things finally started working. I don't make network changes all that so, apparently, what I know used to work and how things work now diverged over time. (Obviously, I'm behind on my "leisure reading".)
It'd be nice, though, if YaST and ip played nice together. Making a change in YaST could run ip behind the scenes to affect the change now while it's writing out the changes to the configuration files.
YaST and the underlying wicked network management system is distro-specific. Permanent configuration gets done via YaST, or direct edits to the config files...
BTW, alternative network management frameworks offered by openSUSE are NetworkManager or systemd-networkd.
I generally use NetworkManager, but as I reported in the openSUSE thread you started, I switched to using wicked temporarily and tested adding an additional IP address to a network interface via YaST GUI, and it did make the changes dynamically. It was reflected in the output of the 'ip' command as expected, and I could ping it successfully.
The 'ip' command (part of iproute2) is used for for controlling and monitoring various network interfaces, addresses, and routes in the Linux kernel. It is not (and never was) used for permanent configuration (although I guess it could be if incorporated in a boot script).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.