How To Change IP Address Of Remote Machine?

Hi all

This is bothering me too much, please tell me how to change IP address of remote machine while using ssh successfully.

I follow these steps:
1. connect to remote server using 'ssh root@server'
2. Edit '/etc/sysconfig/network-scripts/ifcfg-eth0' file
3. issue 'service network restart' command... (at this point ssh connection gets hanged)
4. Break from hanged ssh connection (<ENTER>~.)
5. Wait for some time to let service restart
6. Then finally, ssh with new ip address.

All is fine, but last time, i did something wrong while assigning new IP address, and after service restart, remote server didn't get new ip address - and now i cant connect to remote server.

Fortunately, i had a friend there, who helped me correct the problem so that i can connect again.

But what to do when there is no one to help? Is there other way i should approach this problem?

Thanks


Similar Content



Trying To Change The IP Address And The Hostname

I have two servers, “ServerA” and “ServerB”. Using SLES SP3.

ServerA is the main server with LTSP running

I have used DD to image the drives from ServerA to ServerB. ServerB now boots and is identical to ServerA,and all is well. I want to use ServerB as a backup server, so if ServerA goes down I can bring server online. Obviously in order to put them both on the same network (to keep the user files updated on a daily basis) I need to change the IP address and the host name of serverB (currently is the same as ServerA).

I have done the following (copied from my notes):
Code:
  The following file, binds the ethernet MAC address to ETH0 or ETH1 etc..  We need to delete this file so that a new one is automatically created during reboot with the correct MAC address bound to ETH0
  Delete this file:
      /etc/udev/rules.d/70-persistent-net.rules

  make sure to change the static IP address in the following files
    /etc/dhcp.d
    /etc/hosts
    /etc/sysconfig/network/ifcfg-eth0
    /opt/ltsp/i386/etc/ltsp.conf

  give the system a different host name in:
    /etc/HOSTNAME

Reboot the system

When I change the HOSTNAME, the server will boot, bring me to a log in screen and then after I log in it will just sit there with the green background and a cursor. What files am I forgetting to change..

How To Solve Scp Ssh Port 22 Error ?

Hi!

Im trying to use scp to copy changed httpd.conf files to 2 remote machines (the script is executed in one machine from remote and the result is copied to the both).

scp -vvv first_machine_name@ip_address:filename \second_machine_name@second_ip_address:/usr/local/apache/conf

Using RHEL 5.7 with mremote in windows 7 im getting this error:

ssh: connect to host <ip address> port 22: Connection refused

How can I solve it ? Thanks.

Regular Expression In Expect Script To Prevent Printing To Screen

Hello, I have an expect script where I ssh to a remote host to determine the network configuration and get from the user the network interface card that should be used. From their response, I determine the subnet mask and save the information to a text file that is later transmitted back to my local host. This is all so that I can set up virtual IP aliasing and verify that the physical IP address of the local and remote host are on the same subnet prior to continuing with the setup. I am running the script on Linux, with expect version 5.45.

The code itelf works just fine, but I'm having some issues with how it displays on the screen. As you'll see below in the example, the default system prompt displays, as does the user input command that I'm sending to the shell from the expect script.

Is there a regular expression or something that I can write to prevent the prompt and command that I'm sending from printing to the screen? I know that it should be suppressed if I have an expect command following the Code:
send -s "\nread n_card?'Enter the network interface card number for this server (i.e. eth0):   '\r

command, but everything I have tried for strings and regular expressions to expect causes the netstat -rn output to not show up all of a sudden. I'm new to expect, so I'm not really sure why this is happening.

I would really appreciate any help/suggestions. Thanks for your time!

Part of the Script Code:
Code:
expect {
   -re $prompt {   ;# Send individual commands and get user input
        set timeout -1
        
        # Get partner hostname and put in vipsetup.txt file
        send -s "hostname > vipsetup.txt\r"  
        expect -re $prompt
        
        # Display the network routing info for the user and prompt for 
        # network interface card number
        send -s "print \"The network routing table for the $ptner server is displayed below:\n\" ; netstat -rn \r"
        
        expect -re "\r(.*):\r"
        send -s "\nread n_card?'Enter the network interface card number for this server (i.e. eth0):   '\r"
        interact "\r" return    ;# Wait for user input from read command
        send -- "\r"
        send -s "echo \$n_card >> vipsetup.txt\r"  
        
        # Obtain subnet mask information for partner based on network 
        # interface card number being used
        send -s "msk=\$(cat /etc/sysconfig/network-scripts/ifcfg-\$n_card | grep NETMASK)\r"
        send -s "msk=\$(echo \${msk#NETMASK=})\r"
        send -s "echo \$msk >> vipsetup.txt\r"
    }
    timeout {
        send_user "Connection to host $hostip timed out."
        exit 6 
    }
    eof {
        send_user "Connection to host $hostip failed."
        exit
    }
}


Script Output:
Code:
The network routing table for the PRIMARY server is displayed below:
 
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
10.105.65.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0
0.0.0.0         10.105.65.1     0.0.0.0         UG        0 0          0 eth0
 [root@remotehost root]$
[root@remotehost root]$ ber for this server (i.e. eth0):   '              < 
Enter the network interface card number for this server (i.e. eth0):   eth0

No Network At Startup, But Network After Restart

Hi Folks,
Installed Mint-mate 17.
It gives message:You are now disconnected" after logging in.
I restart, the network connection comes.
It is not "networking restart", but system restart.

Tried five more times. The behaviour is every time the same.
After booting the system, no network connection. But from there I restart the system, then network connection is on.

Very irritating to always boot it second time to get the network connection up.

The computer is a desktop Dell Optiplex 9010.
On the same computer, Windows 7 runs without any problem.

Any idea how to fix it?

Thanks

Network Configuration For Redhat 7

I just installed Redhat 7 and try to config the network , add the IP address to network card , but I got the problem.

I modify the file /etc/sysconfig/network-scripts/ifcfg-enp0s3 , the configuration is as below , and then reboot .

DEVICE="enp0s3"
NETBOOT="yes"
HWADDR="08:00:27:15:38:B7"
TYPE="Ethernet"
BOOTPROTO="none"
NAME="enp0s3"
UUID="462f4834-4fe7-43a7-84e7-83b2722e94c1"
ONBOOT="yes"
IPADDR="192.168.1.1"
NETMASK="255.255.255.0"

After reboot , I use "ip addr show" still not shown the ip address , the ip address is still blank , would advise what is wrong ? thanks

FileZilla Connection Issues

Hello,

I am having issues connecting to my linux box (opensuse 11.3) from my Window 7 sytem. I am using FileZilla. When I attempt to connect I get this error message

Status: Connecting to 192.168.198.205...
Response: fzSftp started
Command: open "Mike@192.168.198.205" 22
Command: Trust new Hostkey: Once
Command: Pass: *********
Error: Authentication failed.
Error: Critical error
Error: Could not connect to server

I am thinking it is a setup on issue on my Linux box but not sure what to change at this point. I must have some settings correct, because I am able to remote into my Linux box using FreeNX. Any help would be appreciated

Screen Sharing In Fedora 20

hi,

I am using fedora core 20. To access desktop from remote I followed the instructions mentioned in the website.

http://hex.ro/wp/blog/fedora-20-remo...rom-windows-7/

1. Settings -> System -> Sharing – enable Sharing then for Screen Sharing enable it and then enable all checkboxes
2. Added port in firewall
#firewall-cmd --add-service=vnc-server
3. Set the command
# gsettings set org.gnome.Vino require-encryption false

From other machine, using Tight vncviewer when I entered the IP address of this machine, I get full black screen. Please help me in this regards.

Thanks in advance.
uv.

How Can I Run An Executable File On A Remote Linux Server Using Putty?

Hi, I'm trying to run an executable file on a remote server using Putty? I downloaded PuTTY and connected through the Putty Configuration window with the SSH connection type selected. Once I connected, the cmd window disappeared so I assume I'm connected. Now I want to run an executable file on the remote server.

How can I run an executable file on my remote Linux server using Putty?

Thanks for any help with this.

CentOS 6 - Connection Reset By Peer Error

Hi,

I have a CentOS 6 machine [Machine X], which I connect to using a putty client or from another CentOS 6 machine.

Now, the machine X intermittently sends a connection reset message to all SSH sessions -

Code:
Read from remote host 1.1.1.1: Connection reset by peer
Connection to 1.1.1.1 closed.

I have switched off the firewall on the machine & there are no session timeout values set.

How do I find out what is causing this issue?


Thanks

Bhushan

The Web Proxy Server Has Detected A Problem In Clear Os?

My web server displayed the following error to the website i log to the web browser.

Details:
Website address: http://exampleweb.com
Warning message: connection failed
Ip address: 182.x.x.x
internet connection status: connected.