[Mageia-discuss] Temporarily changing IP address

AL13N alien at rmail.be
Tue May 22 19:51:30 CEST 2012


> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 22/05/12 16:59, AL13N wrote:
>>> On 22/05/12 15:08, AL13N wrote:
>>>>>>> No :-(  No difference, even though I restarted the
>>>>>>> network service,
>>>>>
>>>>> Lets start from scratch.
>>>>>
>>>>> But first, can you tell me the ip address of the NAS and
>>>>> your laptop's IP address for eth0.
>>>>>
>>>>> After making note of these, put the laptop back to it's
>>>>> original config. (i.e. remove the manually created interface) and
set wlan0 not to come up on reboot.  Then restart so you only have
an ip address on eth0.
>>>>>
>>>>> Then send me the info.
>>>>>
>>>>> Doug
>>>>
>>>> in fact, if we want it to be even simpler, you could add the
>>>> ip address without a alias interface wit iproute2
>>>>
>>>> []# ip addr show eth0
>>>
>>> # ip addr show eth0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu
1500 qdisc pfifo_fast state UP qlen 1000 link/ether
>>> 1c:75:08:28:bd:e4 brd ff:ff:ff:ff:ff:ff inet 169.254.100.1/24 brd
169.254.100.255 scope global eth0 inet6
>>> fe80::1e75:8ff:fe28:bde4/64 scope link valid_lft forever
>>> preferred_lft forever
>>>
>>>> []# ip addr add www.xxx.yyy.zzz/netmask dev eth0
>>>
>>> # ip addr add www.192.168.0.20/255.255.255.0 dev eth0 Error: an inet
prefix is expected rather than
>>> "www.192.168.0.20/255.255.255.0".
>>>
>>> Not sure what it is expecting.
>>
>> hum, i meant the socalled CIDR notation: 4 parts of ip address
>> followed by a subnet mask,
>>
>> in your case, i'd do:
>>
>> []# ip addr add 192.168.0.20/24 dev eth0
>>
> Meanwhile, I played with alternatives, knowing that it must be
> something close to what I'd already tried.  So,
>
> # ip addr add 192.168.0.20/255.255.255.0 dev eth0
> # ip addr show eth0
> 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast
state UP qlen 1000
>     link/ether 1c:75:08:28:bd:e4 brd ff:ff:ff:ff:ff:ff
>     inet 169.254.100.1/24 brd 169.254.100.255 scope global eth0
>     inet 192.168.0.20/24 scope global eth0
>     inet6 fe80::1e75:8ff:fe28:bde4/64 scope link
>        valid_lft forever preferred_lft forever
>
> So now it appears to have two addresses, preferring the wrong one.


by preferring, you mean the top one?


>> then if you do
>>
>> []# ip addr show eth0
>>
>> again, you'd see it was there, as well as the extra route for that range:
>>
>> []# ip route
>>
> # ip route
> default via 192.168.0.1 dev eth1  proto static
> default via 169.254.100.100 dev eth0  metric 10
> default via 192.168.0.1 dev eth1  metric 10
> 169.254.100.0/24 dev eth0  proto kernel  scope link  src 169.254.100.1
>  metric 10
> 192.168.0.0/24 dev eth1  proto kernel  scope link  src 192.168.0.101
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.20


whoa, 3 default routes? over different interfaces...

you have 192.168.0.0/24 network, both reachable over eth1 and eth0, i hope
that is what you want...


>>
> ifconfig
> eth0      Link encap:Ethernet  HWaddr 1C:75:08:28:BD:E4
>           inet addr:169.254.100.1  Bcast:169.254.100.255
> Mask:255.255.255.0
>
>>>
>>> Shorewall and iptables are currently stopped.
>>
>> Be careful of this, in your case, it might not matter, but
>> shorewall stop has policy DROP, (i think), allthough iptables
>> should have policy ACCEPT.
>>
>> so, you'd have to stop shorewall first, then stop iptables.
>
> That's the order I did it.
>>
>> personally, i'd rather not stop the firewall, due to security
>> reasons though. but since with this solution, you don't have any extra
interface, even just restarting it would be fine.
>>
> Once I have a connection I'll restart them.
>
>> if you want to debug even further:
>>
>> []# tcpdump -n -i eth0 host <nas_ip>
>>
> Where does that write to?  A log file?
>
>> and try to connect and then you can see what sourceip and destip are
set and if a reply is coming back.
>>
> At the end of this, though, I can ping both the NAS on 192.168.0.200 and
other LAN connections.
>
> Last question, then, is whether this is a permanent change?

ip command is never permanent, you have to change the config files if you
want permanent changes (ie: after reboot).




More information about the Mageia-discuss mailing list