LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 04-30-2015, 10:26 PM   #1
kokihong
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.

Regards,

Kihong, Ko

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

Rep: Reputation: 37
In windows i configure the metric...in linux may be you can try this... http://www.linuxquestions.org/questi...rfaces-591796/
 
Old 05-01-2015, 09:03 AM   #3
jpollard
Senior Member
 
Registered: Dec 2012
Location: Washington DC area
Distribution: Fedora, CentOS, Slackware
Posts: 4,912

Rep: Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513Reputation: 1513
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 09:06 AM.
 
  


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
Change IP Addres on Centos 5.7 newbie16 Linux - Server 5 12-24-2012 12: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 05:04 AM
How to change MAC addres via C code. Ayalaskin Programming 4 04-13-2010 10:15 AM
Can't change MAC addres - ndiswrapper bjeuk Linux - Wireless Networking 8 02-03-2010 05:15 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:36 AM.

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