Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

changing IP address to a link 1

Status
Not open for further replies.

Esmerelda

Technical User
Jun 20, 2002
105
US
UNIX box is a CMS system (Call Management) with seven Avaya PBXs dumping data. One of the IP addresses changes. I change the IP address in /etc/ hosts, and make the necessary changes in the PBX. Everything looks great, but, it doesn't work. Perhaps I need to remove and add the link to the routing table? I'm a bit timid.

Thanks..
 
Maybe, maybe not. I was hoping to use a smaller, more informed hammer. We have contracted with Cerium to work with me in making the change. They will work directly with me, so I will have the answer. I think it's more of a problem with me not knowing what to do than with a port problem. We will probably do it late next week.
 
OK, the problem has been solved. It was in the routing table. I had to remove the route, and, add it back in, in order for the system to rebuilt the routing table correctly:

94 route delete host switch2 r3sowwa_1
95 route add host switch2 r3sowwa_1 0

switch2 is the name of the ACD link
r3sowwa_1 is the name of the NIC interface
0 is the metric, and, must be used when adding a route

I'm so happy to have finally resolved this.
 
Esmeralda, one of the things I have been doing for years when making a route change even ifconfig changes is, doing it by script... E.g. I have to change an interface address and. Now I know by doing so (if done incorrectly) it could boot me off and if the machine is far, I'm screwed. So what I would do is take all of the current information such as this... (supposing my default is 10.10.1.1 and I have to change it to 10.10.2.1

#!/bin/sh
# failover
ifconfig inet hme0 10.10.2.1 netmask 255.255.255.0
sleep 60
ifconfig inet hme0 10.10.1.1 netmask 255.255.255.0

./failover


If something goes wrong, one minute later it will be back to normal. Since it is a script, even if it boots me off, it will only do so for that amount of time I specify. You can use this sampler for making route changes, firewall changes, etc., it has saved me on more than a few occassions. Would have worked well with route as well.

perl -e 'print $i=pack(c5,(40*2),sqrt(7600),(unpack(c,Q)-3+1+3+3-7),oct(104),10,oct(101));'
 
I had to give you a star for that one, but, am a bit timid with Unix. My perception is that one would use VI to build a script file (file name failover) using Bourne commands? And, then execute it via ./failover. I'm not sure how it would survive a boot. Also, I guess there must be some kind of keepalive, so that, if there isn't any activity for 60 seconds, go back to the original? And, would the file have to be made executable with chmod? Sorry about the elementary questions. There may be others with my limited experience as well.

And, just curious what the perl -e line does (in your signature line). I was tempted, so put it in my command file, and it returned PWND.....?
 
Well, that's interesting. I certainly feel naive. However, please note that there were FOUR question marks in my post. You addressed the last one only. Would that be a Pwn?
 
Binding an IP address to a Network Interface Card 101

#ifconfig $INTERFACE_NUMBER <ip address> netmask <subnet> up --- to bind IP address, subnet, and enable the configuration

Create a file /etc/$INTERFACE_NUMBER with hostname entry
Add entry on /etc/netmasks if IP address is on different subnet
Add entry on /etc/inet/hosts file with IP address and hostname

Change IP Address

#ifconfig $INTERFACE_NUMBER down
to disable the card

#ifconfig $INTERFACE_NUMBER unplumb
remove the card


To bind a virtual IP address to card:

#ifconfig $INTERFACE_NUMBER plumb

#ifconfig $INTERFACE_NUMBER 10.10.10.1 netmask 255.255.255.0 up


To hardcode the speed of the Network Interface Card

Example:
You want to hardcode 100Full Duplex for hme0
#ndd –set /dev/hme instance 0
#ndd –set /dev/hme adv_100fdx_cap 1
#ndd –set /dev/hme adv_100hdx_cap 0
#ndd –set /dev/hme adv_10fdx_cap 0
#ndd –set /dev/hme adv_10hdx_cap 0
#ndd –set /dev/hme adv_autoneg_cap 0

Create an input on the file /etc/system so that when your system rebooted it will run the NIC in 100Full Duplex automatically.
set hme:hme_adv_100fdx_cap=1
set hme:hme_adv_100hdx_cap=0
set hme:hme_adv_10fdx_cap=0
set hme:hme_adv_10hdx_cap=0
set hme:hme_adv_autoneg_cap=0

To check the status
#ndd /dev/hme \?
displays all command options for ndd

#ndd /dev/hme link_status
displays the hme0 link status

The above configurations should be followed in order.

1 = Capable/Enable
0 = Disable
hme1 = instance 1
hme2 = instance 2
hme3 = instance 3

To monitor packets traveling in your NIC ports

Example:
You want to monitor your hme0 port of packets coming from IP address 192.168.1.1
#snoop –d hme0 | grep 202.40.224.14 (if you don't have ngrep installed)

To add or remove a static route

Example:
You want to add a static route to network 10.10.10.0 to your default gateway of 192.168.1.1
#route add –net 10.10.10.0 192.168.1.1

then create a script, so that when the system rebooted the route will automatically added
#echo "route add –net 192.168.16.0 10.236.74.1" >> vi /etc/rc.2/S1000staticroute

You want to delete the static route to network 10.10.10.0 to your default gateway of 192.168.1.1
#route delete –net 10.10.10.0 192.168.1.1

The same method of testing could be employed... So say your current defaul route is 10.20.30.1 and you needed to change it to 10.15.20.1 but were unsure if you would be disaffected by the change...

#printf "route flush\nroute delete default 10.20.30.1\nroute add default 10.15.20.1\nsleep 120\nroute add default 10.20.30.1\n" >> /tmp/routetest
#chmod +x /tmp/routetest ; /tmp/./routetest

What this will do is delete whatever default route you now have, add the new route you want to change for 2 minutes. If all goes well you can vi /tmp/routetest and remove the last two lines and run it. If it doesn't work you will have to wait for two minutes to log back into the machine.

perl -e 'print $i=pack(c5,(40*2),sqrt(7600),(unpack(c,Q)-3+1+3+3-7),oct(104),10,oct(101));'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top