Gentoo Archives: gentoo-user

From: Amankwah <amankwah7@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Changing static IP remotely...
Date: Thu, 28 Feb 2013 06:08:18
Message-Id: 20130228060747.GA2762@Crystal
In Reply to: [gentoo-user] Changing static IP remotely... by Jarry
1 On Thu, Feb 28, 2013 at 05:48:02AM +0100, Jarry wrote:
2 > Hi Gentoo users,
3 >
4 > what is the proper way of changing static IP-address remotely
5 > without the need to restart the whole system (or locking
6 > me out)?
7 >
8 > I have one interface with static IP, so first I'm going to edit
9 > /etc/conf.d/net. Then I will set up command for later execution:
10 >
11 > # echo '#!/bin/bash' > /root/eth-restart
12 > # echo '/etc/init.d/net.eth0 restart' >> /root/eth-restart
13 > # chmod 0700 /root/eth-restart
14 > # at -f /root/eth-restart now + 5 min
15 >
16 > Then I terminate my ssh-session hoping 5 minutes later
17 > I can connect using new IP. Is this correct and all that
18 > is necessary?
19 >
20 > Jarry
21 > --
22
23 I think that is correct but not necessary.
24
25 just using a temporary IP address.
26
27 assume your remote host network interface is eth0, the original IP is
28 addr1, the last IP is addr2, the temporary IP is addr3.
29
30 You can start a ssh session to addr1, and bind a temporary IP to the
31 interface using:
32
33 # ifconfig eth0:0 addr3
34
35 then terminate the ssh session, start a new session to addr3.
36
37 changing the eth0's IP address to addr2
38
39 finally, you can start a ssh session to the last IP address *addr2*
40
41 and release the temporary IP.
42 # ifconfig eth0:0 down