Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Network interface aliasing in /etc/conf.d/net
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Darknight
Guru
Guru


Joined: 26 Jan 2004
Posts: 455
Location: Italy

PostPosted: Tue Oct 22, 2013 11:25 am    Post subject: Network interface aliasing in /etc/conf.d/net Reply with quote

Is it possible? I found this tip from 5 years ago but it doesn't seem to work.
I'd like to use iproute2 (ip link...) to create an alias before the interfaces are started but I can't find documentation about this bit. Any other tool would do, iproute2 is just my fave.
Thanks in advance.
Back to top
View user's profile Send private message
elmar283
Apprentice
Apprentice


Joined: 06 Dec 2004
Posts: 173
Location: Netherlands

PostPosted: Sat Oct 26, 2013 2:24 pm    Post subject: Reply with quote

I'm not sure, but this might help:
https://forums.gentoo.org/viewtopic-t-402654-view-previous.html?sid=cea489a4310e30600d9de491e338b30c
or
http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=4&chap=2
Back to top
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8600

PostPosted: Sat Oct 26, 2013 3:05 pm    Post subject: Reply with quote

As I understand the Wiki page cited by the OP, the advice on the Wiki does not create an alias for the interface, but instead changes the interface name. In the latter case, only the new name is valid. An alias implies both names are valid and refer to the same interface.

OP: interface renaming is often the domain of udev, if you have that installed. If you are using a special system without udev, then there are other ways to do it, including the ip link command you referenced.
Back to top
View user's profile Send private message
Darknight
Guru
Guru


Joined: 26 Jan 2004
Posts: 455
Location: Italy

PostPosted: Sat Oct 26, 2013 6:24 pm    Post subject: Reply with quote

I think a little explanation is in order.
I need the old names for my interfaces instead of the new names as many config files (including some non trivial ones) refer them, I'd rather not spend much time to check and debug everything to use the new names.
To me aliasing a as b, as long as every action I do on a is reflected on b and vice-versa, is as good as renaming and then using just the new name.
Currently I have setup a workaround with this initscript, which works:
Code:
#!/sbin/runscript
description="Creates interface aliases."

depend()
{
        after dbus
        before net
}

start()
{
        echo    Creating interface aliases...
        ip link set enp1s0 name eth0
        ip link set enp4s0 name eth1
        return 0
}

stop()
{
        echo    Nothing to do.
        return 0
}

Why? Because reading around it seems that using udev to rename the interfaces to kernel names at boot time is highly discouraged.
Since most of the interface "manipulation" is performed in /etc/conf.d/net it would have been tidier to put the renaming there, rather than creating a separate initscript.
I'm nitpicking... I know, but it bugged me that I couldn't make it the "my" way so I asked to see if I was missing some critical bit of information, it seems there's no conf.d/net magic that can solve this specific need.
Thank you anyway! :)
Back to top
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8600

PostPosted: Sat Oct 26, 2013 9:44 pm    Post subject: Reply with quote

The solution is not in /etc/conf.d/net because the problem is not in /etc/conf.d/net. The problem is that udev defaults to mangling the names of your network cards. On any system which predates this mangling, this is usually the wrong thing to do, but the udev maintainers defaulted the feature to enabled anyway. The solution is that you need to read news item Upgrading udev to version >=200 and follow its advice. The simplest workaround is to override the stupid udev defaults by creating an empty file named /etc/udev/rules.d/80-net-name-slot.rules.
Back to top
View user's profile Send private message
Gentree
Watchman
Watchman


Joined: 01 Jul 2003
Posts: 5227
Location: France, Old Europe

PostPosted: Sun Oct 27, 2013 10:05 am    Post subject: Reply with quote

to get the news item pre-supposes the update has already been done.

eselect news read

The bottom line, for those wishing to understand and pre-empt the problem is here:

http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/
_________________
Linux, because I'd rather own a free OS than steal one that's not worth paying for.

AthlonXP-M on A7N8X @ 2.6/2.4GHz (winter/summer)
2.6.32-hh1 : portage ~x86
Back to top
View user's profile Send private message
Hu
Watchman
Watchman


Joined: 06 Mar 2007
Posts: 8600

PostPosted: Sun Oct 27, 2013 4:03 pm    Post subject: Reply with quote

I received that news item well before I installed the bad udev version. However, I have seen some people asserting that systems installed after the bad udev was released will never see that news item.
Back to top
View user's profile Send private message
Gentree
Watchman
Watchman


Joined: 01 Jul 2003
Posts: 5227
Location: France, Old Europe

PostPosted: Sun Oct 27, 2013 6:37 pm    Post subject: Reply with quote

"I have seen some people asserting that systems installed after the bad udev was released will never see that news item."

From what I've read, they may not see a login prompt either ;)

udev is one of those packages that I've learnt to mistrust. I often lock it using a mask until there is a need to update it, then I avoid latest version or two and have a quick scan of the formum before moving.

The developers of udev have little regard for the principal of backwards compatibility and seem to take the attitude that everyone else should "develop" around the changes they impose.
_________________
Linux, because I'd rather own a free OS than steal one that's not worth paying for.

AthlonXP-M on A7N8X @ 2.6/2.4GHz (winter/summer)
2.6.32-hh1 : portage ~x86
Back to top
View user's profile Send private message
Darknight
Guru
Guru


Joined: 26 Jan 2004
Posts: 455
Location: Italy

PostPosted: Sun Oct 27, 2013 8:29 pm    Post subject: Reply with quote

Thank you, I'll look at the links and act accordingly.
I'm always nervous when the time comes for an udev update, too. :wink:
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum