Forum Discussion
8 Replies
- shaggyNimbostratus
The TMSH command to modify a virtual server's IP address is:
modify ltm virtual vs-name destination 1.2.3.4:80
This might help you generate the commands (run in bash):
tmsh list ltm virtual destination | tr '\n' ' ' \ | sed 's/ \+/ /g;s/ltm virtual/\ntmsh modify ltm virtual/g;s/nation 1\.1\.1/nation 2.2.2/g';echo
where 1.1.1 are the old octets being replaced with 2.2.2
- Jason_40769Nimbostratus
Thank you so much Shaggy this will help out greatly!
- RiverFishAltostratus
I'm having trouble with this one. Maybe it's because I'm running version 11.5.1. Here's what I did:
- Created a file named bash.sh in the /shared folder.
- Ran the following command: chmod 755 /shared/bash.sh
- Ran the following command: bash /shared/bash.sh
The output looked correct, the desired octet was changed:
modify ltm virtual vs-name { destination 10.10.207.x:80 }
But, the actual VS destinations were not changed. Below is the contents of the bash.sh file:
!/bin/bash tmsh list ltm virtual destination | tr '\n' ' ' \ | sed 's/ \+/ /g;s/ltm virtual/\nmodify ltm virtual/g;s/nation 10\.10\.206/nation 10.10.207/g';echo
- shaggyNimbostratusthe command is meant to generate the commands that can then either be put into a script or run manually. the following should generate a bash script with 'tmsh modify ltm virtual...' commands: echo '!/bin/bash' > /shared/bash2.sh; tmsh list ltm virtual destination | tr '\n' ' ' | sed 's/ \+/ /g;s/ltm virtual/\ntmsh modify ltm virtual/g;s/nation 10\.10\.206/nation 10.10.207/g' >> /shared/bash2.sh; chmod 755 /shared/bash2.sh
- RiverFish_95049Nimbostratus
I'm having trouble with this one. Maybe it's because I'm running version 11.5.1. Here's what I did:
- Created a file named bash.sh in the /shared folder.
- Ran the following command: chmod 755 /shared/bash.sh
- Ran the following command: bash /shared/bash.sh
The output looked correct, the desired octet was changed:
modify ltm virtual vs-name { destination 10.10.207.x:80 }
But, the actual VS destinations were not changed. Below is the contents of the bash.sh file:
!/bin/bash tmsh list ltm virtual destination | tr '\n' ' ' \ | sed 's/ \+/ /g;s/ltm virtual/\nmodify ltm virtual/g;s/nation 10\.10\.206/nation 10.10.207/g';echo
- shaggyNimbostratusthe command is meant to generate the commands that can then either be put into a script or run manually. the following should generate a bash script with 'tmsh modify ltm virtual...' commands: echo '!/bin/bash' > /shared/bash2.sh; tmsh list ltm virtual destination | tr '\n' ' ' | sed 's/ \+/ /g;s/ltm virtual/\ntmsh modify ltm virtual/g;s/nation 10\.10\.206/nation 10.10.207/g' >> /shared/bash2.sh; chmod 755 /shared/bash2.sh
- RiverFishAltostratus
That is slick. Thank you!
If you are sure about the result, you can do it "on the fly". Please don´t forget saving to startup config:
tmsh list ltm virtual destination | tr '\n' ' ' | sed 's/ \+/ /g;s/ltm virtual/\ntmsh modify ltm virtual/g;s/nation 10\.131\.131/nation 10.132.132/g' | bash +x tmsh save sys config