LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-20-2018, 03:30 AM   #1
plutus27
LQ Newbie
 
Registered: Feb 2018
Location: Tokyo, Japan
Distribution: CentOS 7.3
Posts: 3

Rep: Reputation: Disabled
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
 
Old 02-20-2018, 12:06 PM   #2
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,725

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Try reversing the sequence?
Set up IP 131, then add IP 130

I'm curious, tho. Why does it matter which is primary?
 
Old 02-20-2018, 11:36 PM   #3
plutus27
LQ Newbie
 
Registered: Feb 2018
Location: Tokyo, Japan
Distribution: CentOS 7.3
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by scasey View Post
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.
 
Old 02-22-2018, 04:25 PM   #4
scasey
LQ Veteran
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.9.2009
Posts: 5,725

Rep: Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211Reputation: 2211
Quote:
Originally Posted by plutus27 View Post
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.
 
Old 02-28-2018, 11:43 PM   #5
plutus27
LQ Newbie
 
Registered: Feb 2018
Location: Tokyo, Japan
Distribution: CentOS 7.3
Posts: 3

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Problem with primary and secondary IP address on RHEL7 asmoljo Linux - Enterprise 6 11-21-2016 08:48 AM
[SOLVED] WEBMIN - Setting up CENTOS 7 as Secondary DNS (Primary Windows 2008 R2) - ??? Tex47Wilson Linux - Server 1 05-10-2015 02:32 AM
ISC-DHCP-SERVER (primary/secondary) - Can Load Balancing Be Disabled? Sniperm4n Linux - Server 0 03-15-2014 03:45 AM
setting up primary HD and secondary HD dataport Linux - General 8 01-23-2004 10:18 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 07:30 PM.

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