LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE
User Name
Password
SUSE / openSUSE This Forum is for the discussion of Suse Linux.

Notices


Reply
  Search this Thread
Old 06-20-2021, 03:55 AM   #1
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,818

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
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.

Cheers...
 
Old 06-20-2021, 04:08 AM   #2
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,841

Rep: Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148
Quote:
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.
 
Old 06-20-2021, 04:13 AM   #3
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,841

Rep: Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148
Quote:
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)
 
Old 06-20-2021, 12:08 PM   #4
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,818

Original Poster
Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by ferrari View Post
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.

Anyway, thanks for the information.
 
Old 06-20-2021, 06:43 PM   #5
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,841

Rep: Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148Reputation: 1148
YaST and the underlying wicked network management system is distro-specific. Permanent configuration gets done via YaST, or direct edits to the config files...

https://doc.opensuse.org/documentati...a-network.html

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).

https://www.geeksforgeeks.org/ip-com...with-examples/

Also refer
Code:
man ip

Last edited by ferrari; 06-20-2021 at 06:45 PM.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] recovering aliases from aliases.db funkytwig Linux - General 8 03-30-2019 07:55 PM
aliases issue using /etc/aliases lensem Linux - Software 3 04-14-2009 12:48 PM
LXer: Slightly broken Iceweasel 3.0 comes into Debian Lenny LXer Syndicated Linux News 0 07-13-2008 05:20 AM
wrap lines at 80 for long aliases in .aliases.csh jhwilliams Linux - Software 0 07-26-2007 07:49 AM
sendmail and NIS databases (aliases, mail.aliases) - what kind of databases? cotton213 Linux - Software 0 03-14-2006 05:57 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > SUSE / openSUSE

All times are GMT -5. The time now is 03:44 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration