Set the alias of an interface with netifrc

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Set the alias of an interface with netifrc

Alarig Le Lay
Hi,

I would like to set the alias of my interfaces at boot (if possible with
netifrc).

Here are the relevant parts of my configuration:
config_enp3s0f0="null"
vlans_enp3s0f0="20 21 22 50"
config_enp3s0f0_22="185.1.89.13/24 2001:7f8:b1::d/64"

My interface is well created, but if I want an alias, I have to do it by
hand:
asbr02 ~ # ip addr show enp3s0f0.22
11: enp3s0f0.22@enp3s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 00:1b:21:48:68:98 brd ff:ff:ff:ff:ff:ff
    inet 185.1.89.13/24 brd 185.1.89.255 scope global enp3s0f0.22
       valid_lft forever preferred_lft forever
    inet6 2001:7f8:b1::d/64 scope global
       valid_lft forever preferred_lft forever
    inet6 fe80::21b:21ff:fe48:6898/64 scope link
       valid_lft forever preferred_lft forever
asbr02 ~ # ip link set enp3s0f0.22 alias "Peering: BreizhIX"
asbr02 ~ # ip link show enp3s0f0.22
11: enp3s0f0.22@enp3s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default qlen 1000
    link/ether 00:1b:21:48:68:98 brd ff:ff:ff:ff:ff:ff
    alias Peering: BreizhIX

On FreeBSD, I did that with an /etc/start_if script:
ifconfig igb0.22 create
ifconfig igb0.22 description "Peering: BreizhIX"
ifconfig igb0.22 vlan 22 vlandev igb0
ifconfig igb0.22 inet 185.1.89.13/24
ifconfig igb0.22 inet6 2001:7f8:b1::d/64


I didn’t find any mention of this in /usr/share/doc/netifrc-0.5.1/net.example.bz2

Am I missing something?

Thanks,
--
Alarig

Reply | Threaded
Open this post in threaded view
|

Re: Set the alias of an interface with netifrc

Mick-10
On Thursday, 17 January 2019 21:37:32 GMT Alarig Le Lay wrote:

> Hi,
>
> I would like to set the alias of my interfaces at boot (if possible with
> netifrc).
>
> Here are the relevant parts of my configuration:
> config_enp3s0f0="null"
> vlans_enp3s0f0="20 21 22 50"
> config_enp3s0f0_22="185.1.89.13/24 2001:7f8:b1::d/64"
>
> My interface is well created, but if I want an alias, I have to do it by
> hand:
> asbr02 ~ # ip addr show enp3s0f0.22
> 11: enp3s0f0.22@enp3s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
> noqueue state UP group default qlen 1000 link/ether 00:1b:21:48:68:98 brd
> ff:ff:ff:ff:ff:ff
>     inet 185.1.89.13/24 brd 185.1.89.255 scope global enp3s0f0.22
>        valid_lft forever preferred_lft forever
>     inet6 2001:7f8:b1::d/64 scope global
>        valid_lft forever preferred_lft forever
>     inet6 fe80::21b:21ff:fe48:6898/64 scope link
>        valid_lft forever preferred_lft forever
> asbr02 ~ # ip link set enp3s0f0.22 alias "Peering: BreizhIX"
> asbr02 ~ # ip link show enp3s0f0.22
> 11: enp3s0f0.22@enp3s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
> noqueue state UP mode DEFAULT group default qlen 1000 link/ether
> 00:1b:21:48:68:98 brd ff:ff:ff:ff:ff:ff
>     alias Peering: BreizhIX
>
> On FreeBSD, I did that with an /etc/start_if script:
> ifconfig igb0.22 create
> ifconfig igb0.22 description "Peering: BreizhIX"
> ifconfig igb0.22 vlan 22 vlandev igb0
> ifconfig igb0.22 inet 185.1.89.13/24
> ifconfig igb0.22 inet6 2001:7f8:b1::d/64
>
>
> I didn’t find any mention of this in
> /usr/share/doc/netifrc-0.5.1/net.example.bz2
>
> Am I missing something?
>
> Thanks,
Would something like this work?

 vlan22_name="Peering: BreizhIX"

Or,

 enp3s0f0_22_name="Peering: BreizhIX"

--
Regards,
Mick

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Set the alias of an interface with netifrc

J. Roeleveld
In reply to this post by Alarig Le Lay
On Thursday, January 17, 2019 10:37:32 PM CET Alarig Le Lay wrote:

> Hi,
>
> I would like to set the alias of my interfaces at boot (if possible with
> netifrc).
>
> Here are the relevant parts of my configuration:
> config_enp3s0f0="null"
> vlans_enp3s0f0="20 21 22 50"
> config_enp3s0f0_22="185.1.89.13/24 2001:7f8:b1::d/64"
>
> My interface is well created, but if I want an alias, I have to do it by
> hand:
> asbr02 ~ # ip addr show enp3s0f0.22
> 11: enp3s0f0.22@enp3s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
> noqueue state UP group default qlen 1000 link/ether 00:1b:21:48:68:98 brd
> ff:ff:ff:ff:ff:ff
>     inet 185.1.89.13/24 brd 185.1.89.255 scope global enp3s0f0.22
>        valid_lft forever preferred_lft forever
>     inet6 2001:7f8:b1::d/64 scope global
>        valid_lft forever preferred_lft forever
>     inet6 fe80::21b:21ff:fe48:6898/64 scope link
>        valid_lft forever preferred_lft forever
> asbr02 ~ # ip link set enp3s0f0.22 alias "Peering: BreizhIX"
> asbr02 ~ # ip link show enp3s0f0.22
> 11: enp3s0f0.22@enp3s0f0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc
> noqueue state UP mode DEFAULT group default qlen 1000 link/ether
> 00:1b:21:48:68:98 brd ff:ff:ff:ff:ff:ff
>     alias Peering: BreizhIX
>
> On FreeBSD, I did that with an /etc/start_if script:
> ifconfig igb0.22 create
> ifconfig igb0.22 description "Peering: BreizhIX"
> ifconfig igb0.22 vlan 22 vlandev igb0
> ifconfig igb0.22 inet 185.1.89.13/24
> ifconfig igb0.22 inet6 2001:7f8:b1::d/64
>
>
> I didn’t find any mention of this in
> /usr/share/doc/netifrc-0.5.1/net.example.bz2
>
> Am I missing something?

Not sure if you can use spaces in the name, but I have the following:

$ cat /etc/conf.d/net
#config_eno1="dhcp"

config_eno1="null"
vlans_eno1="10 15"
vlan10_name="adm"
vlan15_name="str"
rc_net_adm_need="net.eno1"
rc_net_str_need="net.eno1"
config_adm="10.55.16.44 netmask 255.255.255.0 broadcast 10.55.16.255"
routes_adm="default gw 10.55.16.68"
config_str="10.30.15.44 netmask 255.255.255.0 broadcast 10.30.15.255"

For this to work, configured the init-scripts as:

$ ls -l /etc/init.d/net.*
lrwxrwxrwx 1 root root     6 Jun 16  2016 /etc/init.d/net.adm -> net.lo
lrwxrwxrwx 1 root root     6 Jun 15  2016 /etc/init.d/net.eno1 -> net.lo
-rwxr-xr-x 1 root root 18514 Mar  2  2018 /etc/init.d/net.lo
lrwxrwxrwx 1 root root     6 Jun 16  2016 /etc/init.d/net.str -> net.lo

And only have to add "net.adm" and "net.str" to the runlevel.

--
Joost Roeleveld




Reply | Threaded
Open this post in threaded view
|

Re: Set the alias of an interface with netifrc

Alarig Le Lay
Hi,

On sam. 19 janv. 12:02:20 2019, J. Roeleveld wrote:

> Not sure if you can use spaces in the name, but I have the following:
>
> $ cat /etc/conf.d/net
> #config_eno1="dhcp"
>
> config_eno1="null"
> vlans_eno1="10 15"
> vlan10_name="adm"
> vlan15_name="str"
> rc_net_adm_need="net.eno1"
> rc_net_str_need="net.eno1"
> config_adm="10.55.16.44 netmask 255.255.255.0 broadcast 10.55.16.255"
> routes_adm="default gw 10.55.16.68"
> config_str="10.30.15.44 netmask 255.255.255.0 broadcast 10.30.15.255"
>
> For this to work, configured the init-scripts as:
>
> $ ls -l /etc/init.d/net.*
> lrwxrwxrwx 1 root root     6 Jun 16  2016 /etc/init.d/net.adm -> net.lo
> lrwxrwxrwx 1 root root     6 Jun 15  2016 /etc/init.d/net.eno1 -> net.lo
> -rwxr-xr-x 1 root root 18514 Mar  2  2018 /etc/init.d/net.lo
> lrwxrwxrwx 1 root root     6 Jun 16  2016 /etc/init.d/net.str -> net.lo
>
> And only have to add "net.adm" and "net.str" to the runlevel.

I don’t want to change the name of my interfaces, but the equivalent of
`ip link set ${if} alias "${whatever}"`.

--
Alarig

Reply | Threaded
Open this post in threaded view
|

Re: Set the alias of an interface with netifrc

J. Roeleveld
On Saturday, January 19, 2019 3:36:15 PM CET Alarig Le Lay wrote:

> Hi,
>
> On sam. 19 janv. 12:02:20 2019, J. Roeleveld wrote:
> > Not sure if you can use spaces in the name, but I have the following:
> >
> > $ cat /etc/conf.d/net
> > #config_eno1="dhcp"
> >
> > config_eno1="null"
> > vlans_eno1="10 15"
> > vlan10_name="adm"
> > vlan15_name="str"
> > rc_net_adm_need="net.eno1"
> > rc_net_str_need="net.eno1"
> > config_adm="10.55.16.44 netmask 255.255.255.0 broadcast 10.55.16.255"
> > routes_adm="default gw 10.55.16.68"
> > config_str="10.30.15.44 netmask 255.255.255.0 broadcast 10.30.15.255"
> >
> > For this to work, configured the init-scripts as:
> >
> > $ ls -l /etc/init.d/net.*
> > lrwxrwxrwx 1 root root     6 Jun 16  2016 /etc/init.d/net.adm -> net.lo
> > lrwxrwxrwx 1 root root     6 Jun 15  2016 /etc/init.d/net.eno1 -> net.lo
> > -rwxr-xr-x 1 root root 18514 Mar  2  2018 /etc/init.d/net.lo
> > lrwxrwxrwx 1 root root     6 Jun 16  2016 /etc/init.d/net.str -> net.lo
> >
> > And only have to add "net.adm" and "net.str" to the runlevel.
>
> I don’t want to change the name of my interfaces, but the equivalent of
> `ip link set ${if} alias "${whatever}"`.

Not sure if that is actually "supported" by netifrc.
You could add these commands in a postup() block.

Is there a specific benefit for just setting an "alias" like this?

--
Joost



Reply | Threaded
Open this post in threaded view
|

Re: Set the alias of an interface with netifrc

Alarig Le Lay
On sam. 19 janv. 16:45:42 2019, J. Roeleveld wrote:
> Not sure if that is actually "supported" by netifrc.
> You could add these commands in a postup() block.

I did that, thanks!

> Is there a specific benefit for just setting an "alias" like this?

Yes, knowing what each interface is used for.

--
Alarig

Reply | Threaded
Open this post in threaded view
|

Re: Set the alias of an interface with netifrc

J. Roeleveld
On Sunday, January 20, 2019 1:29:48 AM CET Alarig Le Lay wrote:
> On sam. 19 janv. 16:45:42 2019, J. Roeleveld wrote:
> > Not sure if that is actually "supported" by netifrc.
> > You could add these commands in a postup() block.
>
> I did that, thanks!
>
> > Is there a specific benefit for just setting an "alias" like this?
>
> Yes, knowing what each interface is used for.

That's why I rename the interfaces. That works in all tools and also makes the
config easier.

--
Joost