[SOLVED] problem - setting primary and secondary addresses with mixing configure of dhcp and none
Linux - NetworkingThis forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.
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.
problem - setting primary and secondary addresses with mixing configure of dhcp and none
Hello, guys!
I set adding a secondary IP address in CentOS 7 by nmcli command.
It's worked but problem is that the IP of primary and secondary I just set changed.
I want to set a primary IP is 192.168.228.130/24 and a secondary IP is 192.168.228.131/24.
Please let me know how to handle this.
Here's my condition:
1.before setting:
$ ip addr show
...
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 100
link/ether 00:50:56:8d:09:a1 brd ff:ff:ff:ff:ff:ff
inet 192.168.228.130/24 brd 192.168.228.255 scope global dynamic ens33
valid_lft 599299sec preferred_lft 599299sec
$ nmcli d
DEVICE TYPE STATE CONNECTION
virbr0 bridge connected virbr0
ens33 ethernet connected ens33
2. setting:
$ sudo nmcli con mod ens33 +ipv4.addr 192.168.228.131/24
$ sudo systemctl restart network
3. After setting:
$ ip addr show
...
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
link/ether 00:50:56:8d:09:a1 brd ff:ff:ff:ff:ff:ff
inet 192.168.228.131/24 brd 192.168.228.255 scope global ens33
valid_lft forever preferred_lft forever
inet 192.168.228.130/24 brd 192.168.228.255 scope global secondary dynamic ens160
valid_lft 604795sec preferred_lft 604795sec
Try reversing the sequence?
Set up IP 131, then add IP 130
I'm curious, tho. Why does it matter which is primary?
yeah, I know that there's no problem to operate a system whether the primary IP and the secondary IP are switched.
but, for the system administrator,
it's strange that IP address which connects to the remote server is changed when adding a secondary IP;;
So, I'm just wondering if the primary IP reverse after setting the primary IP and the secondary IP.
yeah, I know that there's no problem to operate a system whether the primary IP and the secondary IP are switched.
but, for the system administrator,
it's strange that IP address which connects to the remote server is changed when adding a secondary IP;;
So, I'm just wondering if the primary IP reverse after setting the primary IP and the secondary IP.
There are some reasons to control which IP is primary. For example, an unpatched qmail installation will use the primary IP address only.
But I'm not familiar with the nmcli utility or the ip command.
I manage the IP addresses by editing the files in /etc/sysconfig/network-scripts/ ... so I have no further advice.
There are some reasons to control which IP is primary. For example, an unpatched qmail installation will use the primary IP address only.
But I'm not familiar with the nmcli utility or the ip command.
I manage the IP addresses by editing the files in /etc/sysconfig/network-scripts/ ... so I have no further advice.
Thanks for your advice.
I also try to manage the IP addresses by editing the network-scripts' files before as you told, but it didn't work;;
Anyway, I actually solved this problem.
First of all, I set the primary IP address by editing BOOTPROTO=static in the ifcfg-eth33's file and then added the secondary IP address by the nmcli command.
Next, I modified the BOOTPROTO=dhcp in ifcfg-eth33's file again and reloaded the network.service.
It was properly set the primary IP and the secondary IP as I thought.
But I still don't understand why the problem of ordering IP addresses happened;;
There's not happen this problem in the test server.
The only different is the CentOS version...the operating server version is CentOS Linux release 7.3.1611 and the test server is CentOS Linux release 7.4.1708.
I'm not sure this happened in the difference of the CentOS version.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.