[opensuse] How do I assign a second ip
How do I assign a permanent second ip address to a single nic on Leap-15.2? I used this as an example bit doesn't seem to work. https://www.linuxnix.com/setup-ip-address-single-nic-linux/ Thanks Mark -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
W dniu 02.10.2020 o 20:08, Mark Hounschell pisze:
How do I assign a permanent second ip address to a single nic on Leap-15.2?
I used this as an example bit doesn't seem to work.
https://www.linuxnix.com/setup-ip-address-single-nic-linux/
Thanks Mark
This instruction is veeeery outdated. First question: what are you using to configure network interfaces? NetworkManager or wicked?
On 10/2/20 2:20 PM, Adam Mizerski wrote:
W dniu 02.10.2020 o 20:08, Mark Hounschell pisze:
How do I assign a permanent second ip address to a single nic on Leap-15.2?
I used this as an example bit doesn't seem to work.
https://www.linuxnix.com/setup-ip-address-single-nic-linux/
Thanks Mark
This instruction is veeeery outdated. First question: what are you using to configure network interfaces? NetworkManager or wicked?
I'm using wicked. And I figured it out. It is in plain sight via yast. Thanks Mark -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
Hi! It does not work, because it's about the RH (network-scripts/ifcfg-*) files, not SUSE (network/ifcfg-*) files and they don't have much more than the "ifcfg-" file prefix in common - they grew up independently. :-) You can use "yast2 lan" to add them and when you'd look into "man 5 ifcfg" documenting the SUSE ifcfg files, you'd find: IPADDR[suffix] {IPv4|IPv6}[/PREFIXLEN] [...] and related (e.g. REMOTE_IPADDR) variables using an optional "[suffix]" which also support both, IPv4 and IPv6 addresses. And also "Multiple addresses" in "EXAMPLES" at the end of the man page. That is you can just append a suffix to the variable name, for example: IPADDR_1="192.168.1.11/24" IPADDR_2="192.168.1.12/24" IPADDR_3="192.168.1.13/24" IPADDR_5="2001:db8::10/64" It works with any suffix, also: IPADDR4="192.168.1.16/24" IPADDR6="2001:db8::16/64" or any other keyword, as long as it remains a /bin/sh variable name. Variables with the same suffix belong together, e.g.: IPADDR_foo="192.168.1.15/32" or REMOTE_IPADDR_foo="192.168.1.1" that results in: There aren't any "ifcfg-eth0:1" files for the Linux kernel **2.0** net aliases emulation, but a LABEL[suffix] variable, which defaults to the name of the interface without :label-suffix, e.g. LABEL_1="eth0:1" LABEL_2="eth0:lan" which would result for an ifcfg-eth0 file in following ip command equivalents (wicked is sending them as msg via netlink to the kernel same as ip does, but is not using the ip utility): ip addr add $IPADDR_1 dev eth0 label $LABEL_1 ip addr add $IPADDR_2 dev eth0 label $LABEL_2 ip addr add $IPADDR_3 dev eth0 ip addr add $IPADDR_5 dev eth0 ip addr add $IPADDR4 dev eth0 ip addr add $IPADDR6 dev eth0 ip addr add $IPADDR_foo peer §REMOTE_IPADDR_foo dev eth0 (the order may differ, this is just an example) that is in: # ip addr add 192.168.1.11/24 dev eth0 label eth0:1 # ip addr add 192.168.1.12/24 dev eth0 label eth0:lan # ip addr add 192.168.1.13/24 dev eth0 # ip addr add 192.168.1.15/32 peer 192.168.1.1 dev eth0 # ip addr add 192.168.1.16/24 dev eth0 # ip addr add 2001:db8::16/64 dev eth0 calls and in following IPs applied to the eth0 interface: # ip addr show dev eth0 [...] inet 192.168.1.11/24 scope global eth0:1 valid_lft forever preferred_lft forever inet 192.168.1.15 peer 192.168.1.1/32 scope global eth0 valid_lft forever preferred_lft forever inet 192.168.1.12/24 scope global secondary eth0:lan valid_lft forever preferred_lft forever inet 192.168.1.13/24 scope global secondary eth0 valid_lft forever preferred_lft forever inet 192.168.1.16/24 scope global secondary eth0 valid_lft forever preferred_lft forever inet6 2001:db8::10/64 scope global valid_lft forever preferred_lft forever inet6 2001:db8::16/64 scope global valid_lft forever preferred_lft forever [...] Note: maximal length of interface with and without label 15. Thus don't become confused, that the obsolete "ifconfig" utility will show the labels as separate interfaces and truncate the names (it is using older limit of AFAIR 9 characters), ... -> use "ip". On 10/2/20 8:08 PM, Mark Hounschell wrote:
How do I assign a permanent second ip address to a single nic on Leap-15.2?
I used this as an example bit doesn't seem to work.
Best regards / Mit freundlichen Grüßen, Marius Tomaschewski <mt@suse.de>, <mt@suse.com> -- SUSE Software Solutions Germany GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany, HRB 36809, AG Nürnberg, GF: Felix Imendörffer -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 10/7/20 7:00 AM, Marius Tomaschewski wrote:
Hi!
It does not work, because it's about the RH (network-scripts/ifcfg-*) files, not SUSE (network/ifcfg-*) files and they don't have much more than the "ifcfg-" file prefix in common - they grew up independently. :-)
You can use "yast2 lan" to add them and when you'd look into "man 5 ifcfg" documenting the SUSE ifcfg files, you'd find:
IPADDR[suffix] {IPv4|IPv6}[/PREFIXLEN] [...]
and related (e.g. REMOTE_IPADDR) variables using an optional "[suffix]" which also support both, IPv4 and IPv6 addresses.
And also "Multiple addresses" in "EXAMPLES" at the end of the man page.
That is you can just append a suffix to the variable name, for example: IPADDR_1="192.168.1.11/24" IPADDR_2="192.168.1.12/24" IPADDR_3="192.168.1.13/24" IPADDR_5="2001:db8::10/64"
It works with any suffix, also: IPADDR4="192.168.1.16/24" IPADDR6="2001:db8::16/64" or any other keyword, as long as it remains a /bin/sh variable name.
Variables with the same suffix belong together, e.g.:
IPADDR_foo="192.168.1.15/32" or REMOTE_IPADDR_foo="192.168.1.1"
that results in:
There aren't any "ifcfg-eth0:1" files for the Linux kernel **2.0** net aliases emulation, but a LABEL[suffix] variable, which defaults to the name of the interface without :label-suffix, e.g. LABEL_1="eth0:1" LABEL_2="eth0:lan"
which would result for an ifcfg-eth0 file in following ip command equivalents (wicked is sending them as msg via netlink to the kernel same as ip does, but is not using the ip utility):
ip addr add $IPADDR_1 dev eth0 label $LABEL_1 ip addr add $IPADDR_2 dev eth0 label $LABEL_2 ip addr add $IPADDR_3 dev eth0 ip addr add $IPADDR_5 dev eth0 ip addr add $IPADDR4 dev eth0 ip addr add $IPADDR6 dev eth0 ip addr add $IPADDR_foo peer §REMOTE_IPADDR_foo dev eth0
(the order may differ, this is just an example) that is in:
# ip addr add 192.168.1.11/24 dev eth0 label eth0:1 # ip addr add 192.168.1.12/24 dev eth0 label eth0:lan # ip addr add 192.168.1.13/24 dev eth0 # ip addr add 192.168.1.15/32 peer 192.168.1.1 dev eth0 # ip addr add 192.168.1.16/24 dev eth0 # ip addr add 2001:db8::16/64 dev eth0
calls and in following IPs applied to the eth0 interface:
# ip addr show dev eth0 [...] inet 192.168.1.11/24 scope global eth0:1 valid_lft forever preferred_lft forever inet 192.168.1.15 peer 192.168.1.1/32 scope global eth0 valid_lft forever preferred_lft forever inet 192.168.1.12/24 scope global secondary eth0:lan valid_lft forever preferred_lft forever inet 192.168.1.13/24 scope global secondary eth0 valid_lft forever preferred_lft forever inet 192.168.1.16/24 scope global secondary eth0 valid_lft forever preferred_lft forever inet6 2001:db8::10/64 scope global valid_lft forever preferred_lft forever inet6 2001:db8::16/64 scope global valid_lft forever preferred_lft forever [...]
Note: maximal length of interface with and without label 15.
Thus don't become confused, that the obsolete "ifconfig" utility will show the labels as separate interfaces and truncate the names (it is using older limit of AFAIR 9 characters), ... -> use "ip".
On 10/2/20 8:08 PM, Mark Hounschell wrote:
How do I assign a permanent second ip address to a single nic on Leap-15.2?
I used this as an example bit doesn't seem to work.
Best regards / Mit freundlichen Grüßen, Marius Tomaschewski <mt@suse.de>, <mt@suse.com> -- SUSE Software Solutions Germany GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany, HRB 36809, AG Nürnberg, GF: Felix Imendörffer
I found how to do it via Yast2. Network Card Setup - General - Additional Address. Just add them there and all works . Mark -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
On 10/7/20 7:00 AM, Marius Tomaschewski wrote:
Hi!
It does not work, because it's about the RH (network-scripts/ifcfg-*) files, not SUSE (network/ifcfg-*) files and they don't have much more than the "ifcfg-" file prefix in common - they grew up independently. :-)
You can use "yast2 lan" to add them and when you'd look into "man 5 ifcfg" documenting the SUSE ifcfg files, you'd find:
IPADDR[suffix] {IPv4|IPv6}[/PREFIXLEN] [...]
and related (e.g. REMOTE_IPADDR) variables using an optional "[suffix]" which also support both, IPv4 and IPv6 addresses.
And also "Multiple addresses" in "EXAMPLES" at the end of the man page.
That is you can just append a suffix to the variable name, for example: IPADDR_1="192.168.1.11/24" IPADDR_2="192.168.1.12/24" IPADDR_3="192.168.1.13/24" IPADDR_5="2001:db8::10/64"
It works with any suffix, also: IPADDR4="192.168.1.16/24" IPADDR6="2001:db8::16/64" or any other keyword, as long as it remains a /bin/sh variable name.
Variables with the same suffix belong together, e.g.:
IPADDR_foo="192.168.1.15/32" or REMOTE_IPADDR_foo="192.168.1.1"
that results in:
There aren't any "ifcfg-eth0:1" files for the Linux kernel **2.0** net aliases emulation, but a LABEL[suffix] variable, which defaults to the name of the interface without :label-suffix, e.g. LABEL_1="eth0:1" LABEL_2="eth0:lan"
which would result for an ifcfg-eth0 file in following ip command equivalents (wicked is sending them as msg via netlink to the kernel same as ip does, but is not using the ip utility):
ip addr add $IPADDR_1 dev eth0 label $LABEL_1 ip addr add $IPADDR_2 dev eth0 label $LABEL_2 ip addr add $IPADDR_3 dev eth0 ip addr add $IPADDR_5 dev eth0 ip addr add $IPADDR4 dev eth0 ip addr add $IPADDR6 dev eth0 ip addr add $IPADDR_foo peer §REMOTE_IPADDR_foo dev eth0
(the order may differ, this is just an example) that is in:
# ip addr add 192.168.1.11/24 dev eth0 label eth0:1 # ip addr add 192.168.1.12/24 dev eth0 label eth0:lan # ip addr add 192.168.1.13/24 dev eth0 # ip addr add 192.168.1.15/32 peer 192.168.1.1 dev eth0 # ip addr add 192.168.1.16/24 dev eth0 # ip addr add 2001:db8::16/64 dev eth0
calls and in following IPs applied to the eth0 interface:
# ip addr show dev eth0 [...] inet 192.168.1.11/24 scope global eth0:1 valid_lft forever preferred_lft forever inet 192.168.1.15 peer 192.168.1.1/32 scope global eth0 valid_lft forever preferred_lft forever inet 192.168.1.12/24 scope global secondary eth0:lan valid_lft forever preferred_lft forever inet 192.168.1.13/24 scope global secondary eth0 valid_lft forever preferred_lft forever inet 192.168.1.16/24 scope global secondary eth0 valid_lft forever preferred_lft forever inet6 2001:db8::10/64 scope global valid_lft forever preferred_lft forever inet6 2001:db8::16/64 scope global valid_lft forever preferred_lft forever [...]
Note: maximal length of interface with and without label 15.
Thus don't become confused, that the obsolete "ifconfig" utility will show the labels as separate interfaces and truncate the names (it is using older limit of AFAIR 9 characters), ... -> use "ip".
# ifconfig -a eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.15.15.150 netmask 255.255.255.0 broadcast 10.15.15.255 inet6 fe80::2e0:4dff:fe7a:8cee prefixlen 64 scopeid 0x20<link> ether 00:e0:4d:7a:8c:ee txqueuelen 1000 (Ethernet) RX packets 43660449 bytes 5462743918 (5.0 GiB) RX errors 0 dropped 0 overruns 4 frame 4 TX packets 12235386 bytes 114408320421 (106.5 GiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 19 eth0:sharon: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 10.15.15.16 netmask 255.255.255.255 broadcast 0.0.0.0 ether 00:e0:4d:7a:8c:ee txqueuelen 1000 (Ethernet) device interrupt 19 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1000 (Local Loopback) RX packets 80685 bytes 13042268 (12.4 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 80685 bytes 13042268 (12.4 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 # ip addr show dev eth0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000 link/ether 00:e0:4d:7a:8c:ee brd ff:ff:ff:ff:ff:ff inet 10.15.15.150/24 brd 10.15.15.255 scope global eth0 valid_lft forever preferred_lft forever inet 10.15.15.16/32 scope global eth0:sharon valid_lft forever preferred_lft forever inet6 fe80::2e0:4dff:fe7a:8cee/64 scope link valid_lft forever preferred_lft forever Mark -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org
participants (3)
-
Adam Mizerski
-
Marius Tomaschewski
-
Mark Hounschell