Change IP on interface VLAN remote


Is it an easy way to change a interface VLAN remote?
As far as I see it is not possible to set more than one IP an a interface...

20 replies

Userlevel 1
You can make a script that does it for you, something like:

unconfig default ipaddress
config default ipaddress x.x.x.x/xx

That should do it.
Userlevel 1
how would you go about creating a script to work with XOS.

say if I needed to change a switch interface remotely and unconfig would obviously drop me from connection, is there a way to upload script and run from within XOS
Userlevel 1
Sorry should have written that too 🙂

You can make the script directly on the switch with the command :

edit script "script_name"

You will then use the builtin VI editor to make the script, and then you can load that script with the command :
Load script "script_name.xsf"

You can also make the script in notepad++ or what ever text editor you use, and save it as a .xsf file and upload into the switch with the command:
tftp get x.x.x.x vr vr-xx "filename.xsf"

That should get you the file onto the switch and you can again load the script as mentioned before.
Tommy wrote:

Sorry should have written that too 🙂

You can make the script directly on the switch with the command :

edit script "script_name"

You will then use the builtin VI editor to make the script, and then you can load that script with the command :
Load script "script_name.xsf"

You can also make the script in notepad++ or what ever text editor you use, and save it as a .xsf file and upload into the switch with the command:
tftp get x.x.x.x vr vr-xx "filename.xsf"

That should get you the file onto the switch and you can again load the script as mentioned before.

Hi all;

I have tried that way but it is not possible to change ipaddress via remote connection.

You can change ipaddress via serial connection using that script because your connection doesn't closed during the operation.

But if you try running script via remote connection it won't work. I think it is the same thing as configuring it manually line by line.

Regards,

Burak.
Tommy wrote:

Sorry should have written that too 🙂

You can make the script directly on the switch with the command :

edit script "script_name"

You will then use the builtin VI editor to make the script, and then you can load that script with the command :
Load script "script_name.xsf"

You can also make the script in notepad++ or what ever text editor you use, and save it as a .xsf file and upload into the switch with the command:
tftp get x.x.x.x vr vr-xx "filename.xsf"

That should get you the file onto the switch and you can again load the script as mentioned before.

Did you update your routes as Drew mentioned?

Regards,
Chris
Tommy wrote:

Sorry should have written that too 🙂

You can make the script directly on the switch with the command :

edit script "script_name"

You will then use the builtin VI editor to make the script, and then you can load that script with the command :
Load script "script_name.xsf"

You can also make the script in notepad++ or what ever text editor you use, and save it as a .xsf file and upload into the switch with the command:
tftp get x.x.x.x vr vr-xx "filename.xsf"

That should get you the file onto the switch and you can again load the script as mentioned before.

I've directly connected to switch while i was trying that. There's only default vlan.

Thanks,

Burak
Userlevel 1
Tommy wrote:

Sorry should have written that too 🙂

You can make the script directly on the switch with the command :

edit script "script_name"

You will then use the builtin VI editor to make the script, and then you can load that script with the command :
Load script "script_name.xsf"

You can also make the script in notepad++ or what ever text editor you use, and save it as a .xsf file and upload into the switch with the command:
tftp get x.x.x.x vr vr-xx "filename.xsf"

That should get you the file onto the switch and you can again load the script as mentioned before.

Are you changing IP within the same subnet?
Tommy wrote:

Sorry should have written that too 🙂

You can make the script directly on the switch with the command :

edit script "script_name"

You will then use the builtin VI editor to make the script, and then you can load that script with the command :
Load script "script_name.xsf"

You can also make the script in notepad++ or what ever text editor you use, and save it as a .xsf file and upload into the switch with the command:
tftp get x.x.x.x vr vr-xx "filename.xsf"

That should get you the file onto the switch and you can again load the script as mentioned before.

Yes , the new ip address is in the same subnet.

And again if i run this script via serial console it perfectly works.

Thanks.
Userlevel 1
Tommy wrote:

Sorry should have written that too 🙂

You can make the script directly on the switch with the command :

edit script "script_name"

You will then use the builtin VI editor to make the script, and then you can load that script with the command :
Load script "script_name.xsf"

You can also make the script in notepad++ or what ever text editor you use, and save it as a .xsf file and upload into the switch with the command:
tftp get x.x.x.x vr vr-xx "filename.xsf"

That should get you the file onto the switch and you can again load the script as mentioned before.

The script is on the remote switch?
Tommy wrote:

Sorry should have written that too 🙂

You can make the script directly on the switch with the command :

edit script "script_name"

You will then use the builtin VI editor to make the script, and then you can load that script with the command :
Load script "script_name.xsf"

You can also make the script in notepad++ or what ever text editor you use, and save it as a .xsf file and upload into the switch with the command:
tftp get x.x.x.x vr vr-xx "filename.xsf"

That should get you the file onto the switch and you can again load the script as mentioned before.

unconfigure vlan default ipaddress
configure vlan default ipaddress 192.168.10.4/24
Userlevel 1
Tommy wrote:

Sorry should have written that too 🙂

You can make the script directly on the switch with the command :

edit script "script_name"

You will then use the builtin VI editor to make the script, and then you can load that script with the command :
Load script "script_name.xsf"

You can also make the script in notepad++ or what ever text editor you use, and save it as a .xsf file and upload into the switch with the command:
tftp get x.x.x.x vr vr-xx "filename.xsf"

That should get you the file onto the switch and you can again load the script as mentioned before.

and you have used tftp to store this on remote switch?
Tommy wrote:

Sorry should have written that too 🙂

You can make the script directly on the switch with the command :

edit script "script_name"

You will then use the builtin VI editor to make the script, and then you can load that script with the command :
Load script "script_name.xsf"

You can also make the script in notepad++ or what ever text editor you use, and save it as a .xsf file and upload into the switch with the command:
tftp get x.x.x.x vr vr-xx "filename.xsf"

That should get you the file onto the switch and you can again load the script as mentioned before.

No. I've created the script file using edit script command.
Userlevel 1
Tommy wrote:

Sorry should have written that too 🙂

You can make the script directly on the switch with the command :

edit script "script_name"

You will then use the builtin VI editor to make the script, and then you can load that script with the command :
Load script "script_name.xsf"

You can also make the script in notepad++ or what ever text editor you use, and save it as a .xsf file and upload into the switch with the command:
tftp get x.x.x.x vr vr-xx "filename.xsf"

That should get you the file onto the switch and you can again load the script as mentioned before.

If you upload the file on the remote switch and run from remote switch.
Tommy wrote:

Sorry should have written that too 🙂

You can make the script directly on the switch with the command :

edit script "script_name"

You will then use the builtin VI editor to make the script, and then you can load that script with the command :
Load script "script_name.xsf"

You can also make the script in notepad++ or what ever text editor you use, and save it as a .xsf file and upload into the switch with the command:
tftp get x.x.x.x vr vr-xx "filename.xsf"

That should get you the file onto the switch and you can again load the script as mentioned before.

Again it is the same.
Userlevel 7
Tommy wrote:

Sorry should have written that too 🙂

You can make the script directly on the switch with the command :

edit script "script_name"

You will then use the builtin VI editor to make the script, and then you can load that script with the command :
Load script "script_name.xsf"

You can also make the script in notepad++ or what ever text editor you use, and save it as a .xsf file and upload into the switch with the command:
tftp get x.x.x.x vr vr-xx "filename.xsf"

That should get you the file onto the switch and you can again load the script as mentioned before.

Hi Burak,
I recently did this same process on one of our lab management switches without any issue. There should be no difference when you run the script via telnet/SSH or through console. It sounds like that's the problem you're describing though - that the same script that works on console doesn't work through a Telnet/SSH.

What doesn't work about it? Are you unable to re-connect to the new IP after running the script? Or are you expecting to see the CLI prompt appear after the script runs - because you won't see that, you'll be kicked from the switch when the IP is unconfigured.

-Drew
Tommy wrote:

Sorry should have written that too 🙂

You can make the script directly on the switch with the command :

edit script "script_name"

You will then use the builtin VI editor to make the script, and then you can load that script with the command :
Load script "script_name.xsf"

You can also make the script in notepad++ or what ever text editor you use, and save it as a .xsf file and upload into the switch with the command:
tftp get x.x.x.x vr vr-xx "filename.xsf"

That should get you the file onto the switch and you can again load the script as mentioned before.

Hi Drew;

I was expecting to change the default vlan's ip address via remote access.

There 's only default vlan on the switch and when i ran the script via telnet or ssh it unconfigures default vlan but couldn't configure it with the new ip address.

So i lost my connection to the switch and i had to reconfigure it via serial console.

After that i was looking for a different way to do that and i saw this subject on the community and thaught that somebody could help me with this problem.

Regards,

Burak
Tommy wrote:

Sorry should have written that too 🙂

You can make the script directly on the switch with the command :

edit script "script_name"

You will then use the builtin VI editor to make the script, and then you can load that script with the command :
Load script "script_name.xsf"

You can also make the script in notepad++ or what ever text editor you use, and save it as a .xsf file and upload into the switch with the command:
tftp get x.x.x.x vr vr-xx "filename.xsf"

That should get you the file onto the switch and you can again load the script as mentioned before.

I wouldn't have expected this to work on Linux/Unix, so was surprised when it sounded like it might on XOS. In linux, as soon as a command is run that would disconnect your current ssh/telnet session, the batch file exits.

Can you create another vlan with it's own IP temporarily for the purpose of changing the default vlan's IP? create the vlan on the target switch and the switch it connects to, ssh give them both IPs in the temporary vlan, ssh to the target's temp IP from the other switch, change default vlan's ip, destroy temporary stuff.
Tommy wrote:

Sorry should have written that too 🙂

You can make the script directly on the switch with the command :

edit script "script_name"

You will then use the builtin VI editor to make the script, and then you can load that script with the command :
Load script "script_name.xsf"

You can also make the script in notepad++ or what ever text editor you use, and save it as a .xsf file and upload into the switch with the command:
tftp get x.x.x.x vr vr-xx "filename.xsf"

That should get you the file onto the switch and you can again load the script as mentioned before.

I wouldn't have expected this to work on Linux/Unix, so was surprised when it sounded like it might on XOS. In linux, as soon as a command is run that would disconnect your current ssh/telnet session, the batch file exits.

Can you create another vlan with it's own IP temporarily for the purpose of changing the default vlan's IP? create the vlan on the target switch and the switch it connects to, ssh give them both IPs in the temporary vlan, ssh to the target's temp IP from the other switch, change default vlan's ip, destroy temporary stuff.
Nice, thanks for the fast reply
Userlevel 7
Don't forget to check any routes (default or otherwise) that may be tied to the VLAN IP you're changing. You could end up with a switch with a new IP, but no route back to you.
At least then you can telnet or SSH to it from another device or switch in the same subnet and take care of it.

Reply