Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-30-2015, 11:26 PM   #1
LQ Newbie
Registered: Apr 2015
Posts: 1

Rep: Reputation: Disabled
How to change the primary IP addres?

Java Application that we are currently using, read the IP information via using sigar library(sigar.getNetInterfaceConfig()

when we use the sigar.getNetInterfaceConfig(), it brings Primary Network Interface from the

server, and this is the problem for us.

we are using Centos server now and connected with 2 of network which are eth0, eth1.

we need to gather the IP from etho0, however in sigar, it brings the ip from eth1.

It seems that primary IP of current server set as eth1.

Therefore, we were looking for answer to modify primary IP at Centos, but could not find yet.

We really want to know how to modify or set up primary IP at Centos.

Thanks for reading such a long story from us.


Kihong, Ko

ps. i used CentOS6
Old 05-01-2015, 02:41 AM   #2
Registered: Jul 2006
Posts: 260

Rep: Reputation: 37
In windows i configure the linux may be you can try this...
Old 05-01-2015, 10:03 AM   #3
Senior Member
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,713

Rep: Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279Reputation: 1279
As an alternative, you might find out how the java application is getting the IP number...

My bet is that it is using the host name, and by default, that host name is usually associated with the first network connection, and like many applications, this one doesn't look for two IP numbers.

If this is the case, just put the host name on the second network connection as an alias.

Another note: if this IS the case, the metric values will not make any difference.

Where I worked we did this as normal practice:

hostname-eth0 - internal admin network
hostname-eth1 - external public access network

And then made "hostname" be an alias for hostname-eth1.

Doing this in the /etc/hosts file made it easy to change addressing on the fly - only the service needs to be restarted, and depending on how the service works, may not even need that.

Last edited by jpollard; 05-01-2015 at 10:06 AM.


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
Change IP Addres on Centos 5.7 newbie16 Linux - Server 5 12-24-2012 01:36 AM
[SOLVED] firewall accepting rules from public h/w mac addres not from dyanmic ip mac hw addres sanjay87 Linux - Server 2 03-06-2012 06:04 AM
How to change MAC addres via C code. Ayalaskin Programming 4 04-13-2010 11:15 AM
Can't change MAC addres - ndiswrapper bjeuk Linux - Wireless Networking 8 02-03-2010 06:15 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:53 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration