Finding IPv4 foreign address and disabling IPv6 - SOLVED -

Hi,

I'm trying to get the IPv4 source address for SSHD connection however netstat is dropping the last octet.

–-

root@node1:~# netstat -taupen | grep 22

tcp6 0 0 :::22 :::* LISTEN 0 1946 1276/sshd

tcp6 0 104 ::ffff:67.18.187.222:22 ::ffff:125.255.80.:3492 ESTABLISHED0 2014 1305/sshd: sharpeg


As I dont need to use IPv6 I tried disabling it (in /etc/modprobe.d/aliases):


alias net-pf-10 ipv6 //Disabled IPv6 20080911

alias net-pf-10 off

alias ipv6 off


Didn't disable IPv6 however checking modules list there is nothing to disable (linode use motholithic kernels):


root@node1:~# lsmod

Module Size Used by

root@node1:~#


So guess I have two questions:

1. is it possible to get a kernel with IPv6 disabled?

2. how to find the IPv4 address of connections to my linode host?

Thanks

2 Replies

You can disable IPv6 support for most services. For example, to disable it for SSHd edit your config and add the line "AddressFamily inet" and make sure "ListenAddress ::" is commented out. Restart the service and you should see only IPv4 addresses. Your current SSH session will still show in IPv6 format but only until you disconnect.

thanks SelfishMan the "ADdressFamily inet" did the job, "ListenAddress ::" was already commented out.

After a bit more investigating to the netstat -n truncation of the ip6 address I found an open bug report:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=254243

For those that encounter the same thing under Debian Etch you can either:

  • re-package the a patched net-tools or

  • install the testing net-tools package which has the patch applied, which is what I did

I can now see the full ip6 address:

–-

root@node1:~# netstat -taupen | grep 22

tcp6 0 0 :::22 :::* LISTEN 0 17027 2516/sshd

tcp6 0 0 67.18.187.222:22 220.239.42.204:1918 ESTABLISHED 0 17111 2543/sshd: sharpeg

tcp6 0 52 67.18.187.222:22 220.239.42.204:1917 ESTABLISHED 0 17035 2518/sshd: sharpeg

---

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct