Tag Archives: set

Microsoft Azure Set a Static Internal IP Address for a VM

Before you specify a static IP address from your address pool, you may want to verify that the IP address has not been already assigned. In the example below, we’re checking to see whether the IP address 10.1.61.140 is available in the TestVNet virtual network.

Test-AzureStaticVNetIP –VNetName TestVNet –IPAddress 10.1.61.140 

Be sure to change the variables for the cmdlets to reflect what you require for your environment before running them.

New-AzureVMConfig -Name $vmname -ImageName $img –InstanceSize Small | Set-AzureSubnet –SubnetNames $sub | Set-AzureStaticVNetIP -IPAddress 10.1.61.140 | New-AzureVM –ServiceName $vmsvc1 –VNetName TestVNet

If you want to set a static IP address for a VM that you previously created, you can do so by using the following cmdlets. If you already set an IP address for the VM and you want to change it to a different IP address, you’ll need to remove the existing static IP address before running these cmdlets. See the instructions below to remove a static IP.

For this procedure, you’ll use the Update-AzureVM cmdlet. The Update-AzureVM cmdlet restarts the VM as part of the update process. The DIP that you specify will be assigned after the VM restarts. In this example, we set the IP address for VM2, which is located in cloud service StaticDemo.

Get-AzureVM -ServiceName StaticDemo -Name VM2 | Set-AzureStaticVNetIP -IPAddress 10.1.61.140 | Update-AzureVM

When you remove a static IP address from a VM, the VM will automatically receive a new DIP after the VM restarts as part of the update process. In the example below, we remove the static IP from VM2, which is located in cloud service StaticDemo.

Get-AzureVM -ServiceName StaticDemo -Name VM2 | Remove-AzureStaticVNetIP | Update-AzureVM

How do I extend the terminal width or set term variables with ksh? / Not Getting the full command info from ps in Unix terminal ?

To identify processes to kill we need to view the FULL output from the ps command (we use the comm field). But by default we are not able to view full command.  So here is the solution..

Solaris :

/usr/ucb/ps -awux

You may need two “w” options. From ps(1b):

-w Uses a wide output format (132 columns rather than 80). If the option letter is repeated, that is, -ww, uses arbitrarily wide output. This information is used to decide how much of long commands to print.

AIX / Linux :

I have a putty remote session or any terminal session with ksh shell. When I insert a long command I can see ‘<‘ suddenly appear on the line and my command begins to scroll horizontally between prompt and ‘<‘ sign while I keep on writing it.

I want to make it clear: a ‘<‘ sing does not appear at the end of the visible line (ie. limited by putty window) but in the middle of it. Is there a way to change it to higher value? I tried TERM, but did not set it.

Answer: You have to define $COLUMNS after you login or in .kshrc. Similarly, you can also define $LINES.

Open your .kshrc or edit .kshrc, and add

# echo $SHELL
/usr/bin/ksh
# export COLUMNS=1000
# ps -ef

 

How do I extend the terminal width or set term variables with ksh? / Not Getting the full command info from ps in Unix terminal ?

To identify processes to kill we need to view the FULL output from the ps command (we use the comm field). But by default we are not able to view full command.  So here is the solution..

Solaris :

/usr/ucb/ps -awux

You may need two “w” options. From ps(1b):

-w Uses a wide output format (132 columns rather than 80). If the option letter is repeated, that is, -ww, uses arbitrarily wide output. This information is used to decide how much of long commands to print.

AIX / Linux :

I have a putty remote session or any terminal session with ksh shell. When I insert a long command I can see ‘<‘ suddenly appear on the line and my command begins to scroll horizontally between prompt and ‘<‘ sign while I keep on writing it.

I want to make it clear: a ‘<‘ sing does not appear at the end of the visible line (ie. limited by putty window) but in the middle of it. Is there a way to change it to higher value? I tried TERM, but did not set it.

Answer: You have to define $COLUMNS after you login or in .kshrc. Similarly, you can also define $LINES.

Open your .kshrc or edit .kshrc, and add

# echo $SHELL
/usr/bin/ksh
# export COLUMNS=1000
# ps -ef