Hi all,
I was trying to add a extra IP address to my server's localhost because I wanted to run a apache virtual host on a separate IP address.
I used sudo ip addr add 127.0.0.5/32 dev lo
and then I could ping 127.0.0.5 successfully. When I'd finished, I ran
sudo ip addr del 127.0.0.5/32 dev lo
which didn't return any error messages.
I than ran ping 127.0.0.5 and still got responses.
I ran sudo ip addr del 127.0.0.5/32 dev lo again and it told me that it could not do it "RTNETLINK answers: Cannot assign requested address"
It may be that the ip addr add has nothing to do with it, but on this machine, my server, I can ping any address I've tried in the 127.*.*.* range and get a response. Is this normal, or have I messed something up? If so, what have I messed up? Is there anything I can run that show's what's providing these ports?
It's an Ubuntu machine, running dnsmasq, apache.
Ubuntu 10.04.3 LTS
Any ideas? Or am I being thick???
Steve
On 25 July 2011 17:56, steve-ALUG@hst.me.uk wrote:
I was trying to add a extra IP address to my server's localhost because I wanted to run a apache virtual host on a separate IP address.
I used sudo ip addr add 127.0.0.5/32 dev lo
and then I could ping 127.0.0.5 successfully.
Your "lo" interface should have a mask of 255.0.0.0 which means 127.*.*.*, so you don't need to explicitly add any more local addresses. Just use them!
Tim.
On 25-Jul-11 16:56:19, steve-ALUG@hst.me.uk wrote:
Hi all,
I was trying to add a extra IP address to my server's localhost because I wanted to run a apache virtual host on a separate IP address.
I used sudo ip addr add 127.0.0.5/32 dev lo
and then I could ping 127.0.0.5 successfully. When I'd finished, I ran
sudo ip addr del 127.0.0.5/32 dev lo
which didn't return any error messages.
I than ran ping 127.0.0.5 and still got responses.
I ran sudo ip addr del 127.0.0.5/32 dev lo again and it told me that it could not do it "RTNETLINK answers: Cannot assign requested address"
It may be that the ip addr add has nothing to do with it, but on this machine, my server, I can ping any address I've tried in the 127.*.*.* range and get a response. Is this normal, or have I messed something up? If so, what have I messed up? Is there anything I can run that show's what's providing these ports?
It's an Ubuntu machine, running dnsmasq, apache.
Ubuntu 10.04.3 LTS
Any ideas? Or am I being thick??? Steve
A curious query!
To start with, the loopback device "lo" is by default assigned to IP address 127.0.0.1 which, again by default, is given the name "localhost" in /etc/hosts.
So I doubt the wisdom of assigning "lo" to 127.0.0.5 while it is still assigned to 127.0.0.1!
Next, I think you will find that, even without any messing around, any IP address in the 127.0.0.* range is pingable (e.g. I just pinged 127.0.0.57 on my machine, and I haven't fiddled with this at all, and this address is certainly not explicitly assigned to anything).
So perhaps it is not surprising that you got ping responses from 127.0.0.5, since it would do that anyway.
I suspect you have wandered into a hall of mirrors. Watch out, or you may blunder into one and break it! (Or several).
However, I'm no deep expert on these things, so would the real gurus please come in?
Best wishes to all, Ted.
-------------------------------------------------------------------- E-Mail: (Ted Harding) ted.harding@wlandres.net Fax-to-email: +44 (0)870 094 0861 Date: 25-Jul-11 Time: 19:42:28 ------------------------------ XFMail ------------------------------
On 25/07/11 19:42, (Ted Harding) wrote: []
Thanks all.
I had naively assumed that the loopback address was just 127.0.0.1.
Thanks all for enlightening me.
Steve
On 25-Jul-11 20:22:54, steve-ALUG@hst.me.uk wrote:
On 25/07/11 19:42, (Ted Harding) wrote: []
Thanks all.
I had naively assumed that the loopback address was just 127.0.0.1.
Thanks all for enlightening me. Steve
Yes, that would seem to be the explanation. I just successfuly established an ftp connection to 127.0.0.57 and the result was
$ ftp 127.0.0.57 Connected to 127.0.0.57. 220 localhost FTP server (Version 6.4/OpenBSD/Linux-ftpd-0.17) ready. Name (127.0.0.57:ted): ted 331 Password required for ted. Password: <password entered here>
at which point I was successfully logged in, exactly as for 127.0.0.1.
Similarly for an ssh -X connection.
So it looks as though all addresses in 127.0.0.* work equivelently to each other!
Ted.
-------------------------------------------------------------------- E-Mail: (Ted Harding) ted.harding@wlandres.net Fax-to-email: +44 (0)870 094 0861 Date: 25-Jul-11 Time: 21:54:46 ------------------------------ XFMail ------------------------------