Operating System - HP-UX
1833893 Members
1891 Online
110063 Solutions
New Discussion

Add new IP address for new segment

 
Kenn Chen
Advisor

Add new IP address for new segment

currently i am using one ipaddress for my server and i wish to add new NIC and ipaddress. ANy steps to add in new ip and any effect of my existing NIC ?
Cyber Zen
4 REPLIES 4
Steven Sim Kok Leong
Honored Contributor

Re: Add new IP address for new segment

Hi,

No, your existing NIC settings will not be affected as long as you retain the settings relevant to it in /etc/rc.config.d/netconf.

Below example assumes that you wish to retain the default route out through your existing lan0.

Before adding in new NIC and new IP:

INTERFACE_NAME[0]=lan0
IP_ADDRESS[0]=1.2.3.4
SUBNET_MASK[0]=255.255.255.224
BROADCAST_ADDRESS[0]="1.2.3.31"
INTERFACE_STATE[0]=""
DHCP_ENABLE[0]=0

After adding in new NIC and new IP, add this to your /etc/rc.config.d/netconf accordingly:

INTERFACE_NAME[1]=lan1
IP_ADDRESS[1]=10.0.0.1
SUBNET_MASK[1]=255.255.255.224
BROADCAST_ADDRESS[1]="10.0.0.31"
INTERFACE_STATE[1]=""
DHCP_ENABLE[1]=0

If you want to reference this NIC locally within the system with a name, then you will also need to update /etc/hosts accordingly.

During the next system reboot, the new settings will take effect. If you want it to take effect before next reboot:

# /sbin/init.d/net stop
# /sbin/init.d/net start

Hope this helps. Regards.

Steven Sim Kok Leong
pap
Respected Contributor

Re: Add new IP address for new segment

Hi Idris,

It is very Simple.

just open a file /etc/rc.config.d/netconf

Look for following entries in this file :

INTERFACE_NAME[0]=lan0
IP_ADDRESS[0]=10.2.0.10
SUBNET_MASK[0]=255.255.254.0
BROADCAST_ADDRESS[0]=10.2.1.255
LANCONFIG_ARGS[0]="ether"
DHCP_ENABLE[0]=0

just copy this whole lot for each additional NIC you want to configure just below it.

The above entry is for your existing NIC card.

Now for additional NIC card you have to copy above lines just below the existing entry

modify the following things in new entry set.

1.Replace lan0 by lan1 in new entry.
2. IP address by new IP address for NIC card.
3. Subnet mask for new card.

That's it.

you are now set for using new NIC.
This will not be affecting your existing card.

so your new netconf file will look like this :


INTERFACE_NAME[0]=lan0
IP_ADDRESS[0]=10.2.0.10
SUBNET_MASK[0]=255.255.254.0
BROADCAST_ADDRESS[0]=10.2.1.255
LANCONFIG_ARGS[0]="ether"
DHCP_ENABLE[0]=0

INTERFACE_NAME[0]=lan1
IP_ADDRESS[0]="new IP address"
SUBNET_MASK[0]=new subnet mask
BROADCAST_ADDRESS[0]=10.2.1.255
LANCONFIG_ARGS[0]="ether"
DHCP_ENABLE[0]=0


Thanks,

-Piyush

"Winners don't do different things , they do things differently"
Steven Sim Kok Leong
Honored Contributor

Re: Add new IP address for new segment

Hi,

A word of caution. Bear in mind that the index must be unique for different NIC cards. Taking the first two lines (for each NIC) in my response, notice that the index for each configuration entry is different:

First NIC card index 0:

INTERFACE_NAME[0]=lan0
IP_ADDRESS[0]=1.2.3.4
...

Second NIC card index 1:

INTERFACE_NAME[1]=lan1
IP_ADDRESS[1]=10.0.0.1
...

Something to take careful note of.

Hope this helps. Regards.

Steven Sim Kok Leong
pap
Respected Contributor

Re: Add new IP address for new segment

Sorry about the index.
You can use [1]. [2] ..... for new cards .
Thanks,
-Piyush
"Winners don't do different things , they do things differently"