date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,632,160,214,000
I have a machine that contains a disk which one has CentOS 6 Installed. In that disk, There are two partitions. One of them if mounted on /boot, and the second one is a PV for the rootvg. I need to replace this disk. How to copy OS from one disk to another safely with no software like Acronis or Symantec Ghost?
If the size of the disks are the same, you can copy the whole disk. dd if=/dev/sda of=/dev/sdb
How to replace a disk which contains the CentOS6
1,632,160,214,000
I have installed windows 10 in my laptop in BIOS Legacy mode.I have 3 primary partitions including the Windows partition and have extended partition with 2 more logical partitions. Now for installing Arch-Linux I created 4 more logical partitions for /boot,root,swap and /home in that order under the extended partition...
I'm not sure what the cause of the problem was exactly but I fixed it by booting from a windows 10 live disk and performing a startup repair. That solved the problem and now I get GRUB on booting the system.
Arch Linux: GRUB does not load after installation
1,632,160,214,000
I have a Linux Mint 17.1 Partition at /dev/sda1 and another Mint 17.1 Partition at /dev/sda5. How do I set the MBR to boot into /dev/sda1 instead of the GRUB menu? I know how to use GParted to delete the /dev/sda5 partition but not how to set the MBR.
Grub is a piece of software that is installed in the MBR. Delete sda5 and run grub-update or change grub config manually to boot from sda1, Maybe this howto can help you. http://www.techsupportforum.com/357-how-to-configure-grub-bootloader-in-mint-linuxubuntu/ If grub is installed on sda u can change the grub config t...
How to set MBR to Linux Partition instead of GRUB
1,632,160,214,000
I'm using fedora 18 side by side Windows 7 and i want to remove fedora. I'm going to that by deleting the fedora partitions from Windows 7. PS: when i installed in the first place fedora, I didn't overwrite MBR, the GRUB2 is installed in /boot partition. So is this method will expose me to problem when the laptop boot...
If you see the Windows Boot Loader and not grub when turning on your machine then deleting the Linux partition should be fine. You don't need to do this to get a new install of Fedora though, you can just instal over the old system as long as you format your / partition during the install process, you will be fine.
Is this the right way to uninstall Fedora from a dual-boot system?
1,387,949,048,000
I am trying to do an IF statement from the output of an executed commmand. Here is how I am trying to do it, but it doesn't work. Does anyone know the right way to do this? if [ "`netstat -lnp | grep ':8080'`" == *java* ]; then echo "Found a Tomcat!" fi EDIT: I wonder if there is a way to do it by capturing exit...
Use the bash [[ conditional construct and prefer the $(<command>) command substitution convention. Additionally, [[ prevents word splitting of variable values therefore there is no need to quote the command substitution bit.. if [[ $(netstat -lnp | grep ':8080') == *java* ]]; then echo "Found a Tomcat!" fi
How to do an if statement from the result of an executed command
1,387,949,048,000
What's the easiest way to find an unused local port? Currently I'm using something similar to this: port=$RANDOM quit=0 while [ "$quit" -ne 1 ]; do netstat -a | grep $port >> /dev/null if [ $? -gt 0 ]; then quit=1 else port=`expr $port + 1` fi done It feels awfully roundabout, so I'm wondering if the...
If your application supports it, you can try passing port 0 to the application. If your application passes this to the kernel, the port will be dynamically allocated at request time, and is guaranteed not to be in use (allocation will fail if all ports are already in use). Otherwise, you can do this manually. The scri...
What's the easiest way to find an unused local port?
1,387,949,048,000
netstat -s prints out a lot of very detailed protocol statistics like number of TCP reset messages received or number of ICMP "echo request" messages sent or number of packets dropped because of a missing route. When in Linux netstat is considered deprecated at nowadays, then is there an alternative? Statistics provid...
netstat has indeed been deprecated by many distributions, though it's really much of the "net-tools" package (including ifconfig, route and arp) that has been deprecated in favour of the "iproute2" package. iproute2 has evolved along with the latest Linux networking features, and the traditional utilities have not. Th...
alternative to "netstat -s"
1,387,949,048,000
Ex.: an sshd is configured to only listen on wlan0. So. Besides checking the sshd_config how can I check that a daemon is listening on what inerface? netstat can do it? how? (OS: openwrt or scientific linux or openbsd) UPDATE: I thought sshd could be limited to an interface... but no... (192.168.1.5 is on wlan0...) #...
(you might have to install the package ip on openwrt (v12 / attitude adjustment) ifconfig/netstat etc. are considered deprecated, so you should use (as root) ss -nlput | grep sshd to show the TCP/UDP sockets on which a running program which contains the string sshd is listening to -nno port to name resolution -lonly...
How to check that a daemon is listening on what interface?
1,387,949,048,000
What does column 'tcp6' mean on output netstat? Please anyone explain the follow output of netstat: tcp6 0 0 dmz.local.net:www 5.140.235.6%14631:49964 ESTABLISHED 21393/apache2 What does tcp6 mean?
tcp6 simply means TCP protocol over IP v6. tcp6 0 0 dmz.local.net:www 5.140.235.6%14631:49964 ESTABLISHED 21393/apache2 As from the netstat manual: tcp6: The protocol used. Here it is TCP over IPv6 0: The count of bytes not copied by the user program connected to this socket. 0: The count of bytes not acknowledged...
tcp6 in the output netstat
1,387,949,048,000
I have a computer with: Linux superhost 3.2.0-4-amd64 #1 SMP Debian 3.2.60-1+deb7u3 x86_64 GNU/Linux It runs Apache on port 80 on all interfaces, and it does not show up in netstat -planA inet, however it unexpectedly can be found in netstat -planA inet6: Active Internet connections (servers and established) Proto Re...
By default if you don't specify address to Apache Listen parameter, it handles ipv6 address using IPv4-mapped IPv6 addresses. You can take a look in Apache ipv6 The output of netstat doesn't mean Apache is not listening on IPv4 address. It's a IPv4-mapped IPv6 address.
netstat — why are IPv4 daemons listening to ports listed only in -A inet6?
1,387,949,048,000
I've heard many times now that it is, and I'm mostly using ss now. But I sometimes get frustrated with differences between the two, and I would love some insight. Also, I can't be the only one who thinks of Hitler when using ss. Not a great name.
Found an article on deprecation from 2011. It seems like the whole net-tools package was not maintained for a while and so it was deprecated. In Debian 9 it is not even installed by default. From the project page it seems like there were no updates at least since 2011. But you can easily install netstat (and e.g. ifco...
Why is netstat deprecated? [closed]
1,387,949,048,000
I am using chromium browser (chrome) with pepperflashplugin in Debian. I have noticed, chromium/pepperflashplugin opens a listening port on my public interface 0.0.0.0:5353 as seen with netstat: netstat -lptun Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name udp 0 0 0....
I noticed this issue when I check for local listening ports with ss -utln before Google brought me here. My first thought of disabling this is to take a look at chrome://flags. And I found this: chrome://flags/#device-discovery-notifications Disabling this so-called "device discovery" feature turns off listening of mD...
chromium browser (pepperflashplugin) opening listening ports on 0.0.0.0:5353
1,387,949,048,000
I've been trying to modernise my way with Linux by, for one thing, ditching netstat for ss. I looked up my favourite command line flag for netstat in the ss man pages, and was very glad to find that netstat -lnp is more or less the same command as ss -lnp. Or so I thought... # ss -lnp | grep 1812 Turns up nothing, bu...
A recent version of ss should also display UDP listeners in that way. You can limit to UDP with ss -unlp. I have tried a recent Debian version where ss --version reports ss utility, iproute2-ss140804 and that does work. On A Red Hat 5 system with ss utility, iproute2-ss061002 it doesn't. You do get more info there usi...
ss is replacing netstat, how can I get it to list ports similarly to what I am used to?
1,387,949,048,000
When executing netstat, I find that the command's output width is limited regardless of the console size, in contrast with other commands such as ps that seem to get adjusted. So for example: $ sudo netstat -natp | grep sshd tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1454/sshd ...
As explained in this response to a similar question regarding aptitude and dpkg, netstat is truncating the output because when it's piped to grep, it doesn't know how wide the output should be. Solutions to this general problem depend specifically on the options to the program that's being fed into the pipe. In the ...
Netstat output line width limit
1,387,949,048,000
I simply open an http server from my terminal (with node) listening on port 3000, which is obviously working if I request localhost:3000 in a browser. Now, I want to see this connection so I use netstat. I'm supposed to see server connection on port 3000, and client connection on another port: $ netstat -p tcp Pr...
Does anyone know what hbci means or refers to? HBCI stands for "Home Banking Computer Interface", see http://openhbci.sourceforge.net/. The same port number is also used by the "RemoteWare Client", at least according to http://www.networksorcery.com/enp/protocol/ip/ports03000.htm. The reason you are seeing it is bec...
TCP *:hbci (LISTEN) - What does hbci mean? [duplicate]
1,387,949,048,000
If I execute ss -lu in order to view all the listening UDP sockets, then none of the sockets are displayed. If I execute ss -au, which lists all(both listening and non-listening) UDP sockets, then "listening" sockets are displayed as UNCONN (see below). What is the logic behind this? For example running atftpd listeni...
UDP is a connectionless protocol. SS probably won't show one in LISTEN state, only in UCONN or ESTAB. If I do this, $ nc -u -l 2333 Then ss will show (in a 2nd shell): $ ss -au|grep 2333 UNCONN 0 0 *:2333 *:* If I then connect to it (3rd shell) $ nc -u local...
why ss(8) understands listening UDP ports differently than netstat(8)?
1,387,949,048,000
I'm trying to implement code that enumerate all existing TCP connections per process (similar to netstat -lptn). I prefer to implement it myself and not to rely on netstat. In order to do that, I'm parsing data from /proc/<PID>/net/tcp. I saw that a number of TCP connections are listed under /proc/<PID>/net/tcp but no...
There are many misunderstandings in your approach. I'll go over them one by one. Sockets are not associated with a specific process. When a socket is created its reference count is 1. But through different methods such as dup2, fork, and file descriptor passing it's possible to create many references to the same sock...
reading TCP connection list from /proc
1,387,949,048,000
Is there a command similar to netstat -np but grouped by state and PID? I'd like to know the current count of server connections in a particular state grouped by Programs. similar to, 102 squid ESTABLISHED 32 httpd ESTABLISHED I use RHEL5.
You can use sort to reorganize the output of netstat in any format you like. $ netstat -anpt 2>&1 | tail -n +5 | sort -k7,7 -k 6,6 This will sort the output using the 7th column first (the process name/PID) followed by the state (ESTABLISHED, LISTEN, etc.). NOTE: The first part of the command, netstat -anpt 2>&1 | ta...
Command similar to netstat -np but grouped by state and PID?
1,387,949,048,000
$ netstat -nat Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:53 0.0.0.0:* LISTEN tcp ...
By default sshd uses ipv4 and ipv6. You can configure the protocol sshd uses through the AddressFamily directive in /etc/ssh/sshd_config For ipv4 & ipv6 (default) AddressFamily any For ipv4 only AddressFamily inet For ipv6 only AddressFamily inet6 After you make any changes to sshd_config restart sshd for the chan...
Why does SSH show protocol as tcp6 *and* tcp in netstat?
1,387,949,048,000
After doing a ssh -fND 1080 localhost, ssh will listen on port 1080 to provide the SOCKS service: box:~$ netstat -ln|grep 1080 tcp 0 0 127.0.0.1:1080 0.0.0.0:* LISTEN tcp6 0 0 ::1:1080 :::* LISTEN box:~$ ss seems to think otherw...
This might help you, ss -tupln | grep 1080
ss not showing all ports being listened on
1,387,949,048,000
On my CentOS 7, at one point, sudo ss -plt listed a port marked as LISTENING on *:30565, but there was no information whatsoever in the process column of its row. The other listening ports were showing their owning process as usual, like users:(("sshd",pid=1381,fd=3)), but that one row did not have any process informa...
The point on netstat not showing the process information on some situations, for instance NFS, is that NFS is a kernel module, and as such, it does not run as a normal process, and does not have a PID. You can regularly find threads about this situation if including NFS on your google searches: netstat doesn't report ...
"netstat -p"/"ss -p" not showing the process of a listening port
1,387,949,048,000
Can I view the source code of netstat on my Linux machine?
Yes you can. Download it. But as you don't say what flavor of linux re you using here is couple of examples: Debian/Ubuntu related: # What package is the netstat executable in? apt-file search /usr/bin/netstat # Now download the source of that package apt-get source net-tools CentOS/Red Hat: yumdownloader --source ne...
Source code of netstat
1,387,949,048,000
There is a long list of stats in /proc/net/netstat and /proc/net/snmp, both of which I think come from the net-tools project. Is there any official or unofficial documentation about these fields? Or even a good source of networking terminology that would help identify them? Some seem pretty clear: SyncookiesSent Synco...
The /proc/net/* files are generated by the kernel: the entries are in net/ipv4/proc.c in the kernel source, and the entry list is found in include/uapi/linux/snmp.h. It grabs the values from various MIB databases that the kernel keeps. According to the snmp.h header file, the MIB definitions come from the following do...
Is there documentation for /proc/net/netstat and /proc/net/snmp?
1,387,949,048,000
Could anyone explain the following output of netstat -plunt? udp 0 0 0.0.0.0:58262 0.0.0.0:* 1163/avahi-daemon: udp 0 0 0.0.0.0:17500 0.0.0.0:* 3779/dropbox:u udp 0 0 0.0.0.0:5353 0.0.0.0:* 1163/avahi-daemon: What does 0.0.0.0:* mean? Are a...
The column after local address is "Foreign Address" - as these are UDP ports, and listening ports, there is no foreign address so a wildcard is shown. I'm not sure if this would show the other end(s) if packets had been received as UDP is a connectionless protocol. Also as one-many comms is allowed a single foreign ad...
What does 0.0.0.0:* mean in netstat?
1,387,949,048,000
In my system I have eth0 (which may or may not be connected) and a modem on ppp0 (which always may be up or down). The the case where both interfaces are up and ppp0 is the default route, I'd like to find a way to determine the gateway IP actual address of eth0. I tried "netstat -rn" but in this configuration the ou...
Assume eth0 is DHCP client interface. One option is to check the DHCP client lease files dhcpd.leases Place and name depends on the system; on some Fedora systems, the files under /var/lib/dhclient/ are lease files, where the interesting string is like that : option routers 192.168.1.1; Another option, which worked...
How to determine eth0 gateway address when it is not the default gateway?
1,387,949,048,000
I want to know if my server establishes a connection to a remote server or if the remote server tries to reach my server. I tried to read the output of lsof and obtain this information: lsof -i TCP:25 USER FD TYPE DEVICE SIZE/OFF NODE NAME master 2657 root 12u IPv4 8086 0t0 TCP *:smtp (LISTE...
I think the clue is in the port numbers, take these two entries smtpd 12950 postfix 9u IPv4 35762406 0t0 TCP hostname:smtp->spe.cif.ic.IP:55277 (ESTABLISHED) smtp 13007 postfix 13u IPv4 35762309 0t0 TCP hostname:34434->fake.VVVVV.fr:smtp (ESTABLISHED) smtpd has received a connection on port sm...
How to use lsof to identify incoming TCP connections?
1,387,949,048,000
I want to see which port, e.g. postgresql is listening on, so I use: netstat -l But that is trying to be clever and prints the process name instead of the port: Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 localhost:postg...
netstat is translating the (default) port to the service name, it gets this mapping from /etc/services file. So, you can get the port from /etc/services: grep '^postgresql' /etc/services Or better add the -n option to netstat to prevent any (host, port, hostname) resolution and post the output in numerics: netstat -n...
netstat show port number instead of process name
1,387,949,048,000
I have two linux servers. Let's say they are C and S. C is client of S On my S machine, I type. $ netstat -an | grep ESTABLISHED tcp 0 0 192.168.1.220:3306 C:57010 ESTABLISHED Then I can know C is connecting now. In the C machine, I'd also like to know the process name which is opening the p...
One way is to say lsof -i:57010 -sTCP:ESTABLISHED. This walks the kernel's open file handle table looking for processes with an established TCP connection using that port. (Network sockets are file handles on *ix type systems.) You'd use -sTCP:LISTEN on the server side to filter out only the listener socket instead. B...
How can I know the process name which is opening a tcp port?
1,387,949,048,000
Hi I feel like this is an obvious question but I haven't been able to get a good answer so far. Given the name of the service (which I know running on localhost) is there any networking command line tool like (netstat/ss) which will tell me what port that service is running at? Ideally something like: $ some-program -...
There are two standard library calls; getservbyname(3) and getservbyport(3). These allow programs to convert a name (e.g. telnet) to a port (23), or from a port back to a name. The typical implementation uses /etc/services as the authoritative source, but this can be changed by the services entry in nsswitch.conf. Th...
Given a service name, get its port number?
1,387,949,048,000
I have a program here, that depends on the output of netstat. More concrete: netstat -apn. Here is an example of a normal output. Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN - A client ...
First you need to make sure that your machine has the necessary locale set up. You can see available locales with locale -a. For example, on my system: $ locale -a C C.UTF-8 el_GR.utf8 en_US.utf8 fr_FR.utf8 POSIX As you can see above, I don't have the Portuguese locale. On my Debian, I can create it by running sudo d...
Language in netstat output
1,387,949,048,000
I use the following command to find open ports on my servers: $ netstat -ntulp I've probably found that on some random website over the years. However, I cannot find where -t or -u are documented. It certainly isn't in the man page. The man page does allude the their existence, and possibly hints that they are synony...
The manpage and netstat --help both say [--tcp|-t] [--udp|-u] in the synopsis. That's more than a hint - this syntax pretty clearly states that -t is the same as --tcp and that -u is the same as --udp. You're right though that the manpage doesn't document --tcp and --udp. netstat --help shows that --tcp and --udp are ...
Where are netstat's -t and -u flags documented?
1,387,949,048,000
We have two apps running (on top of linux) and both communicates through port 42605. I wanted to quickly verify if this is the only port that's been used for communication between them. I tried below rule, but it doesn't seems to work. So, just wanted to get this clarified, if I am doing it wrong. Following is the seq...
We can make INPUT policy drop to block everything and allow specific ports only # allow established sessions to receive traffic iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT # allow your application port iptables -I INPUT -p tcp --dport 42605 -j ACCEPT # allow SSH iptables -I INPUT -p tcp --dport ...
Iptables rule to allow only one port and block others
1,387,949,048,000
Say I want to know how many unique clients are connected to port 5222 on a server. Can you find a way better/faster/stronger than this? netstat -nt | grep ':5222.*ESTABLISHED' | awk '{ print $5 }' \ | grep -Po '[0-9]{1,3}(\.[0-9]{1,3}){3}' | uniq | wc -l I know this is a too simple regex for a internet address, but s...
If you are on Linux and can handle having ss installed: ss -o state established '( dport = :5222 )'|awk -F"[\t :]+" 'NR!=1{ ip[$5]+=1 } END{ for (i in ip){n++};print n }' If you would like the awk explained just let me know.
How to list all unique ip address currently connected to a specific port?
1,387,949,048,000
When I do netstat -tanup as root on my Debian host, process 1/init is displayed for port 993. How is this possible ? I never saw such behavior. The command systemctl list-sockets shows the correct service dovecot associated to port 993. EDIT: I noticed another strange thing: Sytemd reports that davecot is listening ...
By default dovecot run pop , imap , pop3 and imaps on the following ports: 110: pop 143: imap 995: pop3s 993: imaps install dovecot-pop3d then copy dovecot.socket to /etc/systemd sudo cp /lib/systemd/system/dovecot.socket /etc/systemd/system/ sudo systemctl reenable dovecot.socket Modify dovecot.socket: sudo sed -i ...
Netstat display wrong process associated to listening port
1,387,949,048,000
I have a socket connection between a client process and a server process, both running on my machine. There are two entries shown for the connection as, sudo netstat -ntp | grep 56442 tcp 1 0 127.0.0.1:56442 127.0.0.1:8002 CLOSE_WAIT 8276/python tcp 0 0 127.0.0.1:8002 ...
I believe netstat -ntp will only show client (nonlistening) sockets in the Local address column. The -l flag should cause netstat to list server (listening) sockets only, and with -a you should get both and then you can differentiate based on STATEs.
Distinguish TCP server from client within netstat output
1,387,949,048,000
netstat -a reports Recv-Q (amount of unread data pending for a reading application) for AF_INET sockets, but not AF_UNIX sockets (at least not for SOCK_DGRAM). Does anybody know a way to obtain this information for AF_UNIX sockets from outside of the process itself? Barring reporting the amount, is there a way to tell...
I figured out a way. On Linux the ss program is kind of like netstat on steroids - it provides much more information, including the amount of data pending in receive buffers for AF_UNIX sockets. I like ss -ax for my purposes. Man page: http://man7.org/linux/man-pages/man8/ss.8.html See also my answer here: How to s...
How to report receive queue size for AF_UNIX sockets
1,387,949,048,000
If I have no permission to use lsof, how do I get them for a process with pid already known? Thanks I know netstat -l -p command print out active unix domain sockets, but it seems it's not updating ? after I closed the socket, it still shows up in netstat command result.
On Linux you can look through the /proc filesystem specifically for a given PID under /proc/<pid>/fd. All the file descriptors (fd) are listed there per process. Example $ ls -l /proc/27634/fd/ total 0 lrwx------ 1 root root 64 Mar 17 20:09 0 -> /dev/null lrwx------ 1 root root 64 Mar 17 20:09 1 -> /dev/null lrwx-----...
How do I get active unix domain sockets for a specific pid if I can't use lsof command?
1,387,949,048,000
Finding the PID of an established connection is trivial using netstat or lsof. However, I have a process which is creating a connection ever 60 seconds to our database and locking it up by maxing out the failed connection attempt limit. I can increase the failed connection limit to something extremely high on the data...
Consider using SystemTap. It is dynamic instrumenting engine that dynamically patches kernel so you can track any in-kernel event such as opening a socket. It is actively developed by RedHat so it is supported in CentOS. Installing To install SystemTap on CentOS 6: Enable debuginfo repository: sed -i 's/^enabled=0/e...
log PID of each connection attempt
1,536,522,506,000
I have a program that tries to connect to a server on start-up on a unknown port. I need to find out which port the program accesses to enable a ssh tunnel. I tried netstat but since the connection fails I don't find any useful information.
strace -e trace=connect -f yourprogram or using a dump file strace -o yourprogram.strace -e trace=connect -f yourprogram
Find which ports a program access
1,536,522,506,000
I read some tutorials,they say that netstat is deprecated. I tried ss command. THis is the output Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port Process icmp6 UNCONN 0 0...
224.0.0.251 is Multicast DNS, and it use the port 5353 (as you noticed). Many operating systems use it to discover new devices/printers/routers with zero or nearly zero configuration. E.g. if you want to send a page to be print to your printer, with e.g. the address my-printer.local, your operating system uses such po...
What does address 224.0.0.251:5353 represent?
1,536,522,506,000
I have a machine that runs a network intensive application that spawns many processes. I noticed recently that the machine is producing ARP requests looking for an IP address that does not exist. I would like to trace down which process on the box is causing the ARP requests to be generated for the sake of troubleshoo...
ss does show you connections that have not yet been resolved by arp. They are in state SYN-SENT. The problem is that such a state is only held for a few seconds then the connection fails, so you may not see it. You could try rapid polling for it with while ! ss -p state syn-sent | grep 1.1.1.100; do sleep .1; done O...
How does one determine the process causing an ARP request?
1,536,522,506,000
I'm on CentOS 7 with TigerVNC installed. I have started it up (I think), but I can't connect to it. Here's what leads me to think it's running: $ vncserver -list TigerVNC server sessions: X DISPLAY # PROCESS ID :1 29811 But netstat doesn't list it anywhere: $ netstat -tpln Active Internet connections (...
vncserver -list only looks at files in ~/.vnc/. There should be a file in your ~/.vnc/ directory ending with .pid. Make sure that the numeric PID in that file (29811) is actually a running process. It is quite possible that the Xvnc process is not running, but exited in such a way that it didn't clean up the .pid f...
TigerVNC is running, but not listening on any port?
1,536,522,506,000
When a faulty application calls bind() with a TCP socket to a port P but does not follow with listen(), the port P is not listed among open ports, i.e. netstat or ss or ls /proc/net/tcp do not show it, but the port is occupied and no other application can use it. Is there a reasonable way to find such applications and...
Until something more suitable is made available, here's an answer that tries in an absolutely non-industrial way to find processes that used bind(2) on a TCP socket, but then did neither listen(2) nor connect(2), and can also display what's the bound TCP address. Requires getfattr found in a package named attr in mos...
How to find applications/ports that do bind() but don't do listen()?
1,536,522,506,000
I am on a Debian system fresh installed, logged in via ssh on /dev/pts/0, and have entered the following command watch -n 10 clear > /dev/pts/0 ; netstat -tupn 2>/dev/null | grep -v 3306 > /dev/pts/0 and what I get looks like this Every 10.0s: clear Thu Jan 30 17:42:01 202...
It is the output of the clear command … You ran clear. clear produced these control sequences. (They are merely in a different order on my machine.) % clear | cat -v ; echo ^[[2J^[[H^[[3J % On an ECMA-48 terminal or terminal emulator these control sequences erase the display and position the cursor.% clear | consol...
What is this : ^[3;J^[H^[2J?
1,536,522,506,000
Can anyone explain for me what each option in Flg means? [root@apple ~]# netstat -i Kernel Interface table Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg eth0 1500 0 110512 0 0 0 6660 0 0 0 BMRU eth1 1500 0 110713 0 0 ...
They're covered here in the guide: Linux Network Administrators Guide Chapter 5. Configuring TCP/IP Networking. excerpt The last column shows the flags that have been set for this interface. These characters are one-character versions of the long flag names that are printed when you display the interface configuratio...
Understand netstat -i flgs
1,536,522,506,000
After I run $ ssh -L 9000:google.com:80 testme@localhost how can I verify that the port forwarding is established by checking the sockets (internet and unix domain sockets)? Thanks.
Once the SSH connection is established, you’ll see a listening socket on port 9000: $ ss -o state listening 'sport = 9000' Netid Recv-Q Send-Q Local Address:Port Peer Address:Port tcp 0 128 127.0.0.1:9000 *:* tcp 0 128 ...
How can I verify that the port forwarding is established by checking the sockets?
1,536,522,506,000
I got a task to do. I have to search whether, are there running services on below ports. ports 53 & 55 If not I have to send alerts. Please correct my logic and syntax in below code for one port ntstat=`netstat -tulpn | grep :53 | grep LISTEN | awk {'print $4'}` port="*:53" #Just to echo for testing echo $ntstat ec...
You can also do a text-processing to your current output to match the port. Just add sed -e 's/.*:/:/g' #!/bin/bash ntstat=`netstat -tulpn | grep ":53 " | grep LISTEN | awk {'print $4'} | sed -e 's/.*:/:/g'` port=":53 " #Just to echo for testing echo $ntstat echo $port if [[ "$ntstat" == "$port" ]] then echo ...
script to verify running services on specific ports
1,536,522,506,000
I wanted to know which user is running a particular port no. For e.g. netstat -an | grep ':6016' which user is resposible for "6016" port no.
Use netstat -anp | grep ':6016' That will give you the pid of the process connected to the port. Then use ps aux | grep <the pid from the previous command> to get the username that the process is running as.
How to check which user is responsible for a utilizing a particular port?
1,536,522,506,000
netstat command is useful to, Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships. Now, I was reading about the Linux performance which is depicted in a nice pictorial view from here. How is netstat command used in various levels of networking as depi...
Let us look into the performance diagram to understand the various layers in which netstat command is useful for debugging. Ethernet netstat -in command is used in this layer where -i flag is used to display a table of all network interfaces, or the specified iface. IP netstat -an command is used in this layer where...
How does netstat command fit in various layers of TCP/IP model in the performance diagram?
1,536,522,506,000
An application I use downloads data from a specific server, and I need it to sleep after the download has finished and the socket is closed. However downloads take place at random days, the app that downloads checks for updates and only downloads if there is one Proto Recv-Q Send-Q Local Address Foreign Addr...
if you convert your psudo code to sh, here is a test for your if netstat -anp|grep EST|sed 's/^..p6\? \+[^ ]\+ \+[^ ]\+ \+[^ ]\+ \+\([^ ]\+\) \+.*$/\1/'|grep -q 8.8.8.8 && echo connected so you need a while loop and a sleep 10m and a pmset 0 but as my osx box is in storage it would be a good idea to check my re.
OS X: how to keep the computer from sleeping during a http connection
1,536,522,506,000
I was using the following command on my previous dedicated server with the same version of the FreeBSD installation: # uname -a FreeBSD 9.2-RELEASE FreeBSD 9.2-RELEASE #0 r255898: Thu Sep 26 22:50:31 UTC 2013 [email protected]:/usr/obj/usr/src/sys/GENERIC amd64 The command is following: netstat -ntu -f inet Out...
Up to FreeBSD 8.x (at least as of 8.4-RELEASE) it was possible to use the -t option with netstat -i/-I (show the state of all network interfaces/a specific interface). From FreeBSD 8.4-RELEASE netstat man: If -t is also present, show the contents of watchdog timers. This indeed had disappeared from FreeBSD 9.x (see F...
netstat command doesn't work anymore on the new dedicated server
1,536,522,506,000
Can you explain the following lines in the netstat output? Active UNIX domain sockets (w/o servers) Proto RefCnt Flags Type State I-Node Path unix 2 [ ] STREAM CONNECTED 37133819 /tmp/.lxterminal-socket:0-xralf unix 2 [ ] STREAM CONNECTED 37109191 /tmp...
client-server GUI programs Like several other GUI programs nowadays, since 2008 lxterminal has attempted to display all terminal emulator windows from a single process, one per X display per user. To do this, it attempts to connect to an existing socket by the sort of name that you are seeing, that incorporates the d...
lxterminal in the netstat output
1,536,522,506,000
I have 2 machines A 192.168.0.40 (CentOS) B 192.168.0.41 (Debian) Gateway 192.168.0.2 Now I did set a port forwarding using firewallD, from A port 2245 to B port 22 Connection established from client 192.168.0.1 to Machine B trough Machine A Running netstat on machine A # netstat -tulpane output: # netstat -tu...
Why I can't see the Machine B in connections? because it's acting as a router, not an endpoint of the connection. and what shall I do to see it? To show connections tracked by the stateful firewall, run conntrack. http://conntrack-tools.netfilter.org/manual.html#conntrack If you did not have a stateful firewall, y...
netstat, listing connections correctly
1,536,522,506,000
Is there a way to determine which netdev or IP link interface that a given IP address will route over … in bash/shell language? This is not about what an IP address is, given a network device name. Given a destination IP address, bash would automagically determine (with OS assist from its internal IP route table, nets...
ip route get is what you're looking for; maybe it's ip route show to, depending on whether you checking should be allowed to change the routing state. See man ip-route for more details.
Which interface does a specific IP address will get routed over?
1,536,522,506,000
I've noticed one of the headless computers in my network is constantly polling the VNC port on another computer. My problem is, that when I see the port from which it has connected (with tcpdump) and try to find the process with netstat -anp|grep PORT, the process is already killed and nothing is found (the process se...
Try auditctl, it will help. Enabling below rule can flood your system so use just form debugging. auditctl -a exit,always -S execve reference : https://linux.die.net/man/8/auditctl
Find the short-lived process that is polling my port?
1,536,522,506,000
$ sudo netstat -ap | grep postg tcp 0 0 localhost:postgresql 0.0.0.0:* LISTEN 1567/postgres udp 0 0 localhost:57504 localhost:57504 ESTABLISHED 1567/postgres unix 2 [ ACC ] STREAM LISTENING 27116 1567/postgres /var/...
A little bit of digging this is the stats collector. Apparently stats are posted on local loopback (aka localhost) UDP. See here: http://www.neilconway.org/talks/hacking/ottawa/ottawa_slides.pdf . Essentially the different (backend) subprocesses of PostgreSQL are using this UDP port to send statistics to the stats co...
Why does postgresql server have a `localhost:57504` to `localhost:57504` UDP "connection"?
1,536,522,506,000
I have a software that has an HTTP server listening on port 20001 and running on a Unix machine. The logfile of the HTTP server says it currently has 600+ active HTTP connections, however netstat -an | grep 20001 on the same machine where the server is running, shows that there are only 2 TCP connections currently ope...
According to this page, an HTTP session starts with an HTTP request to the server and ends with the server's answer. There may be several request-answer pairs in a TCP session, but sequentially, not at the same time. So, by this definition, you should have: number of TCP sessions >= number of HTTP sessions (it may be...
number of HTTP sessions=number of TCP Sessions?
1,536,522,506,000
I am doing the following to determine if Tomcat is running: $ whoami voops voops@esavo00:~/apache-tomcat-7.0.57/bin# $ ps -ef | grep -i tomcat | grep -v grep voops 8973 1 0 Apr22 ? 00:00:40 /usr/local/jdk1.7.0_67/bin/java -Djava.util.logging.config.file=/home/voops/apache-tomcat-7.0.57/conf/logging.pro...
In case the comments to the question were not clear enough, I am adding an answer here, along with a few Pointers not mentioned in those comments. "Why doesn't Tomcat doesn't show up when I grep netstat's output for 8080 ?" Short Answer : Because Port Number 8080 is getting converted to string http_alt, which will not...
Why doesn't Tomcat show up when I grep netstat's output for 8080?
1,536,522,506,000
Is there a way to get a per-socket send and receive Queues utilization on Solaris similar to the way that Linux' netstat displays it? Example on Linux: Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:19072 0.0.0.0:* LISTEN tc...
This one is per interface and I am looking per socket. Then use just netstat i.e. uname -r 5.10 type netstat netstat is hashed (/usr/bin/netstat) netstat TCP: IPv4 Local Address Remote Address Swind Send-Q Rwind Recv-Q State -------------------- -------------------- ----- ------ ----- ------ ------...
Per Socket network Buffer queues utilization
1,536,522,506,000
From https://unix.stackexchange.com/a/485290/674 Further down in the netstat output is UNIX sockets: Active UNIX domain sockets (servers and established) Proto RefCnt Flags Type State I-Node PID/Program name Path <snip> unix 2 [ ACC ] STREAM LISTENING 21936 1/systemd ...
screen processes don’t maintain socket connections while they’re running; they open and close socket connections as needed when they have messages to send. Thus, when you run screen -r to reconnect to an existing session, it connects to the existing process using a socket, negotiates various settings, and when it’s go...
Why doesn't `netstat` show Screen client but only Screen server process?
1,536,522,506,000
I install atop on Debian 9. It runs as a monitoring daemon. Why is it listening on a raw socket? Raw sockets are used to generate arbitrary IPv4 packets or capture all packets read all packets for a given IP sub-protocol! But I don't think my atop and its logs show any information from reading packets. I don't eve...
The raw socket is opened only to read information like statistics from the netatop kernel module, using getsockopt() (eww). There is no code to read or write raw packets with this socket. https://github.com/Atoptool/atop/blob/v2.3.0/netatopif.c
Why does atop open a raw socket?
1,536,522,506,000
My goal is to ensure that email connections are limited to outbound only So I have two shell commands one is netstat -an | grep ':25' | grep -v '127.0.0.1' | wc -l which prints out 1 The command up above is finding all instances of port 25 besides localhost but does not exclude ipv6 The other command is netstat -an ...
Using awk: netstat -an | grep ':25' | grep -v '127.0.0.1\|::1' | wc -l | awk '{if($0==0) print "compliant"; else print "non-compliant"}' will print complaint if output $0 is 0 else print non-complaint
Using a if/else statement in shell for netsat
1,536,522,506,000
I never learned network programming and this kind of stuff properly. Only know very basic stuff like IP address and just a vague concept of what ports and TCP/IP are. Here, I connected to my lab's server: and I just got curious about this whole network stuff and tried command netstat I understand that these are lists...
The part after the colon is the port number, and it's not always displayed as a number since there's a list of well-known ports uses in /etc/services, so you don't have to remember if 22 is ssh or telnet. (The reverse works as well – you can say telnet localhost http and it will understand http as meaning "port 80".) ...
Why is the 'foreign address' not IP address but something like this?
1,536,522,506,000
On old 43BSD... netstat -f unix Active UNIX domain sockets Address Type Recv-Q Send-Q Inode Conn Refs Nextref Addr 801ca38c dgram 0 0 8008b5c0 0 0 0 /dev/log 801cc10c stream 0 0 8008e690 0 0 0 /dev/printer Address #socket ad...
According to netstat/unix.c those fields are coming from unp->unp_refs and unp->unp_nextref as defined in sys/unpcb.h: /* * A socket may be referenced by a number of sockets (e.g. several * sockets may be connected to a datagram socket.) These sockets * are in a linked list starting with unp_refs, linked through ...
Old 43BSD and netstat output
1,536,522,506,000
Is it normal behavior, or a bug, that when I run ss -nltp, I only see the process/pid information if the user I am running ss -nltp as is the same user as the listening process? $ docker run -it --rm tianon/network-toolbox root@bc058746626a:/# apt update ... root@bc058746626a:/# apt install gosu ... root@bc058746626a:...
For a normal user that's normal behavior. To be able to associate the socket to a process, at some point, /proc/<pid>/fd/ must be read by ss. Only the same user or a privileged process (including running as root) has access to this. Here's an strace excerpt about what is happening outside of Docker. # runuser -u test ...
iproute2 ss - not showing process/pid information if user is not the same user as listening process?
1,536,522,506,000
My loacl server IP is 192.168.122.100, and remote server IP is 192.168.122.50. I need to kill all processes which connect to 192.168.122.50:56666. By executing ss comand, I found there are three TCP connections has been established. But I don't konw which process are using these sockets. How can I find out the PID of...
Using lsof command. Usage: sudo lsof -ni tcp | grep <port> And the 2nd column is PID.
How can I confirm which process is connect to remote port?
1,536,522,506,000
I've recently starting playing around with the Squid caching server on my OS X based computer. I'm curious if there's a way to tell which port Squid is running on using netstat or other standard unix commands. That is, I know Squid runs by default on port 3128, but if I didn't know this or someone had started Squid ...
Listing the open files with -i should show you the ports in use lsof -i If there's too much output lsof -i | grep squid Works with Linux & OS X
What Port is Squid Running on in OS X/BSD
1,536,522,506,000
On the first host, root@xxx:~# netstat -natup | grep xxx tcp 0 0 10.2.5.3:40740 xxx:10051 ESTABLISHED 1482/zabbix_proxy: we can see that a connection has been established with the remote host. root@xxx:~# ps -eo uid,pid,etime | grep 1482 106 1482 18-17:10:17 The connection has been establis...
First, the etime field indicates when the process is started. This does not necessarily means that a connection is bound to it for that time. Next, maybe that some network address translation is being used? If so, please grep for the portnumber on the remote host: netstat -natup|grep 40740 to see what that returns.
Asymmetric ESTABLISHED session in netstat
1,536,522,506,000
How can I have the following command below just show/filter based on the PID's I'm looking for? sudo netstat -lp --inet The results come back as this Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 *:1508 *:* LIS...
netstat itself does not support such filtering. You probably have to do something like: sudo netstat -lp --inet | grep " $pid/"
How to do a netstat that will only filter based on pid
1,380,114,699,000
I'm trying top open a port on my CentOS machine: I edit the /etc/sysconfig/iptables file and add my rule: -A INPUT -p TCP -m state --state NEW -m tcp --dport 143 -j ACCEPT Then I restart the iptable service # service iptables restart But when I'm checking the open ports the one I declared doesn't appear netstat -tu...
Is there a service running on that port after you've opened it? The command netstat -tulpn | less will only show you the ports of daemons that are actually listening on TCP ports. Example Nothing's initially running: $ sudo netstat -tulpn | grep :80 $ Start up Apache: $ sudo /etc/init.d/httpd start Starting httpd: ...
Open a port in my CentOS
1,380,114,699,000
I've got a corporate VPN, which I use to access the Internet. When it's on, I cannot reach the servers inside the corporate network anymore, so I think there are some problems with the gateway setup. Here is the netstat -rn output when the VPN is turned off: Destination Gateway Genmask Flags MSS...
Probably, you need to add appropriate route table entries to reach local intranet server via 10.131.60.1, not via ppp0. Consult with your system administrator if you don't know exactly which addresses should be accessed via local gateway.
VPN and gateway problems
1,380,114,699,000
Having the following topology: hostA(virbr0: 192.168.122.1) -- TAP interface -- (eth0: 192.168.122.85) gw (eth1: 192.168.3.51) --- (LAN: 192.168.3.0/24) gw : QEMU VM Guest, that is acting as a gateway for other QEMU VM Guests, which are connected to it via eth1 interface. gw is connected to the QEMU Host via the Linux...
There are two or three separate problems. dynamic gw IP It would be overkill to use a routing protocol for this (unless you are using one already for other reasons). I would try to change the configuration of gw/eth0 to static. If that is not possible then you could create a user gw on hostA which gets sudo permission...
Configure static routing for the virbr0 using local interface as next hop
1,380,114,699,000
I'm diagnosing an old Solaris 10 build and during port scans I've found an open port that's not on the approved list for this server. I've tried various combinations of netstat switches but I can't seem to get the right output that gives me the associated service name or PID of the open port. The feature set of netst...
For Solaris you can use pfiles <pid> to see which network ports are opened by a certain process. Using a for-loop on /proc/* you can use pfiles on each running process to lookup the port you are after. Drawback is that you will need to be root on Solaris 10, or be able to become privileged (pfexec pfiles) on Solaris 1...
Solaris 10 - Find service attached to listening port
1,380,114,699,000
In the output of netstat -a | grep LISTEN there are usually a lot of processes. How (where) can I find out information about them, what is their purpose in the system and if I can kill them? Which of them can be insecure and which are safe?
How (where) can I find out information about them, First you have to find out which program is bound to each port. Unfortunately, there is no single standard way to do that which will work on all *ix type systems, and your question doesn't specify one. Some versions of netstat have a flag which will include the ass...
How can I identify processes that use network facilities, and can they be killed?
1,380,114,699,000
I am able to ssh to the machine. But my machine not shown as listening on port 22. Below is what I see. It show as listening on port 53, 21, 8080, 8443 etc. But no entry for 22(ssh). My machine IP is 10.8.113.30. OS is windriver linux. Why is this? netstat -antu | grep LISTEN tcp 0 0 127.0.0.1:8083 ...
You machine is listening to port 22. Here's the line: tcp6 0 0 :::22 :::* LISTEN The socket is listening for both IPv6 and IPv4 connections.
Netstat doesn't show my machine IP as listening on port 22
1,380,114,699,000
I'm using netstat to collect information about connected IP's. And I have the following format: netstat -tn 2>/dev/null | awk '/:80 / {print $5}' | sed 's/.*::ffff://' | sed 's/:.*//' | sor t | uniq -c | sort -nr 5 81.133.113.200 4 80.229.142.126 2 94.136.36.29 2 92.19.231.69 2 85.159.56...
Give this tested version a try: netstat -tn 2>/dev/null | awk '/:80 / {print $5}' | sed 's/.*::ffff://' | sed 's/:.*//' | sor t | uniq -c | sort -nr |\ while read index ipaddress ; do \ printf "%s " "${index}" ;\ getent hosts "${ipaddress}" ;\ if [ $? -eq 2 ]; then \ printf "%s\n" "${ipaddress}" ;\ fi ;\ d...
Bash: How to print additional column matching IP Address to Name
1,380,114,699,000
To get to this point I had a Fedora workstation 34 install- iso about a week old - ran update, rebooted, click Install Fedora 35 as it was on offer from gnome Software. Hadn't even opened Firefox yet. Didn't install anything else. I ran netstat just to see what was happening by default. There were a couple established...
The output is truncated, that was a connection to proxy14.fedoraproject.org, probably for an automated check for updates. ss -rt would show you the full host name.
Fresh Fedora 35 - what are these active internet connections doing?
1,380,114,699,000
man netstat says --numeric, -n Show numerical addresses instead of trying to determine symbolic host, port or user names. Does netstat output additional sockets with -n than without -n? Or does netstat output the same set of sockets with -n as without -n? They don't seem to output the same set of sockets: $ sudo n...
It's likely that one of the ports from the 720 list was simply removed in-between those runs; there should be no substantive difference in the number of outputs with or without -n. You're seeing different output with the grep 2049 because the -n flag specifically shows "numerical addresses instead of trying to determi...
Does `netstat` output different sockets with and without -n?
1,380,114,699,000
I have a machine in my organization that I sshed and received a terminal. When I run netstat -ntlp I received: [root@webtl1 ~]# netstat -ntlp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:5355 ...
A simple ps shows only your own processes, not system processes or other users' processes. ps allows options to show more processes, e.g. ps ax or ps -e or ps -A. ps -a doesn't show the process systemd-resolve because it's not associated with a terminal. See man ps for details.
Process appear by "netstat" but doesn't appear by "ps -a"
1,380,114,699,000
In APUE (see the figure below), how do a terminal emulator process and a window manager (e.g. openbox) process communicate? Is a temrinal emulator process a client of a window manager process, based on Unix domain socket? What is the relation of X server process to a terminal emulator process and a window manager pr...
xlsclients is a simple application which is listing the WM_CLIENT_MACHINE and WM_COMMAND properties set on top windows (ie. windows which are children of the root window or have a WM_STATE property). That's about everything that it does. There's no magic. For instance, I'm using my own window manager which has opened ...
What is the server-client relationship between a terminal emulator, a window manager and a X server processes?
1,380,114,699,000
after logging into a server, I used netstat to check out the ports of this server and wanted to find which port was communicating with me My IP is 143.248.143.198 and my search results are like below: [kwagjj@James5 ~]$ netstat | grep 143.248.143.198 tcp 0 52 James5:smakynet 143.248.143.198:496...
Whenever you do not recognize a port by name, you can grep for the name in /etc/services to see that the name is defined there. On my Linux systems, smakynet is TCP/UDP 122. grep smakynet /etc/services Use man netstat to learn about which switches can be used to reveal more information. In this case, use switches tha...
what is 'smakynet' in the netstat result?
1,380,114,699,000
I hope it is possible to get the necessary details of each network port from /etc/services. If I have to develop a C++ program to get the status of each port how should I start it? I am not allowed to call netstat, ss or anything similar from my program. Is there some files in the filesystem from which I can get the ...
It's still not clear to me whether you want to implement netstat -a -t -u or the outer join of /etc/services and netstat -a -t -u, or something else, but here are some ideas that may help: TCP and UDP port numbers range from 1 to 65536. The /etc/services file that you mentioned lists a subset of the well-known ports ...
Status of network ports
1,380,114,699,000
After using netstat -lnp I wonder how comes some of the result don't show any PID/Program name? Should I be worried? See below: Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:33223 0.0...
In netstat, you won't see PIDs if it is a kernel process. Also, like @Mathias Weidner was suggesting, you won't see the PID if the user invoking netstat isn't privileged enough.
netstat -lnp outputing results without PID
1,380,114,699,000
What does ss mean by *:ipproto-255, in the local address/port column? $ sudo ss -ap | grep -vE "^(nl |u_)" Netid State Recv-Q Send-Q Local Address:Port Peer Address:Port p_raw UNCONN 0 0 *:eth0 * users:(("lldpd",pid=742,fd=11)) raw UNCONN 0 0 *:icm...
255 is the value of IPPROTO_RAW. It means this socket allows sending all types of IPv4 packets. (It cannot receive packets). The program has to provide a full IPv4 header. For comparison, the raw socket with *:icmp allows sending and receiving IPv4 packets which use the ICMP protocol. These details are specific to ...
ss shows a raw socket. What does it mean that it is listening on "*:ipproto-255"?
1,380,114,699,000
I've just run the command on my server netstat -atnp It shows 2 established connection via SSH Port, but when I run the command w It shows only 1 shell user. Is there anything I need to worry about? If so, what could it be? & how to find out about what it's about?
In fact you shouldn't be worry. netstat -a will show every socket (open, listenning, closed...) wo there's probably only your listening ssh deamon plus your current connection. In your specific case, I would use lsof -i TCP:22 which is in my opinion far more readable. lsof -i TCP:22 COMMAND PID USER ...
Shows One Shell User, But More Connection Via SSH Port
1,380,114,699,000
What information can I gather from netstat listen queues? Looking at the man page I can see that using "-L" in netstat it shows me the size of listen queues. It tells me information about each column: 1st number of unaccepted connections 2nd number of unaccepted incomplete connections 3rd number of maximum queued co...
Haven't you answered your own question? When there are unaccepted connections the application gets sluggish. If you're wondering whether that behavior is expected then, yes, it is. If incoming connections are queuing the the amount of time spent in the queue increases the request latency for the client leading to t...
Netstat Listen Queues
1,380,114,699,000
Debugging a tcp: out of memory error, I found that a process (from a container) has a lot of connection on CLOSE_WAIT status aka 08 when I cat /proc/XXX/net/tcp But neither netstat or ss were showing those leaked connections. 133: 0E03540A:9D9C 804CC2AD:01BB 08 00000000:00059D7A 00:00000000 00000000 0 0 3...
If you are looking at this from the host, you're in the initial network namespace rather than in the container's network namespace: these connections or states are not seen because they are not handled by the initial network namespace's network stack. When following an entry in the process directory in /proc, this ent...
CLOSE_WAIT not visible on the kubernetes node
1,380,114,699,000
when we perform the following cli on our rhel machine we get more then 600 CLOSE_WAIT lines lsof -i tcp:8088 | grep CLOSE_WAIT java 31100 yarn 385u IPv4 208022048 0t0 TCP master02.hgti.com:radan-http->master02.hgti.com:56504 (CLOSE_WAIT) java 31100 yarn 407u IPv4 208210692 0t0 TCP master02.hgti.c...
I think it might a bug in your application, maybe you can keep it under control if you restart the application before running out of the maximum number of open files / sockets, or increase any artificial limits set by ulimit. Try looking for a bug report, for example: https://issues.apache.org/jira/browse/YARN-9336 h...
rhel + any best practice to minimize the CLOSE_WAIT sessions from linux side
1,380,114,699,000
I am trying to retrieve Local Address-port with port number in different block used by each IP-address in Foreign Address and PID/Program name) from the following and store it in a file: I used: netstat -natp | grep '^[a-z0-9P]*' after that I want to ignore Recv-Q and Send-Q block and take Local Address with its ...
Although kludgy, you can try this: $ netstat -natp 2> /dev/null | awk 'NR==2 {printf("%s\t%s %s\t%s %s\t%s %s\n",$1,$4,$5,$6,$7,$9,$10)} NR>=3 {OFS="\t";print($1,$4,$5,$7)}' EDIT ... and, for the sake of completion if you need the port column separate from its IP direction in your ...
How I can grep data with some spaces and ignoring block?
1,380,114,699,000
I'm admin for some devs and they requested that a port on a machine be clear for a specific purpose. When one of the devs went to use that port, it was in use. An netstat -p showed that xrdp/Xnvc was using it. I tried to have the user jump off and back on to see if it would use another port, but it kept using that one...
In TCP/IP, there is no such thing as "an open port that is not used by anything". Any port that is not currently being used is going to be closed. In addition to that, iptables or any firewall can block certain ports from some or all traffic. (I really hate the talk of "opening a port" in firewalls, because it feeds a...
How to block a service (xrdp) from using a specific port?
1,380,114,699,000
ss --info returns information about tcp connections. It produces a line simliar to the following (some fields removed for formatting) tcp ESTAB 0 0 192.168.1.177:60236 54.70.141.88:https cubic wscale:7,7 rto:204 rtt:0.918/0.419 reordering:59 What exactly does the reordering number mean in this exa...
From TCP Variables: The tcp_reordering variable tells the kernel how much a TCP packet may be reordered in a stream without assuming that the packet was lost somewhere on the way. tcp_reordering may be changed via net.ipv4.tcp_reordering variable of sysctl. By default this value is 3. If you change net.ipv4.tcp_...
What does the reordering field of ss --info mean?
1,380,114,699,000
i am testing stuff with sockets and i encountered that strange case : i coded i very simple tcp server in c, i made it block after accept(), just to see what happen when accepting multiple connection attempts at the same time : Here is an excerpt of code of the server : //listen() if( (listen(sock,5)) == -1) { perro...
The server code calls accept() only once. Thus, only the first connection attempt is effectively accepted and the remaining client connections are kept on a connection request queue which lives in the kernel space. The next client connection will be retrieved from the queue when accept() is called again. No process ow...
sudo netstat -antp not showing PID
1,380,114,699,000
Some program was connected from my local ip 111.111.111.111 with 130.239.18.176:80,how to get the pid number? netstat -np (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) Active Internet connections (w/o servers) Proto Recv-Q Send-Q Local Ad...
The netstat output explains it fairly well: (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) Just run it as root (e.g. sudo netstat -np)
How to get the pid number which connect to external ip?
1,380,114,699,000
So, here I have a basic setup with SOCKS5 proxy listening on, oh, say 8123 I redirect TCP to the proxy via iptables From iptables perspective everything looks peachy, iptables -t nat -v -L shows DNAT tcp -- any any anywhere anywhere to:127.0.01:8123 From the "practical" perspective it's working (Google's account ac...
As far as your browser is concerned, it's connected to 74.125.141.104. A DNAT doesn't change that fact. If you DNAT port 80 coming from the internet to port 80 on an internal webserver at e.g. 10.201.87.80, would you expect netstat on the remote system to show 10.201.87.80 as the remote IP or your external IP? PS: 10....
Unexpected netstat output in DNAT conditions
1,426,981,497,000
I would like to get netstat to not display port numbers on the foreign address so I can run some statistics on it. This is for a FreeBSD system. The following is a example of the output. <root>:/# netstat -an | grep .80 |head tcp4 0 0 61.129.65.176.80 123.120.207.172.51972 ESTABLISHED tcp4 491...
Add this sed command at the end of your pipe. It does a greeding search until last . and delete it and all digits that follow it. ... | sed -e 's/^\(.*\)\.[0-9]*/\1/' It yields: tcp4 0 0 61.129.65.176.80 123.120.207.172 ESTABLISHED tcp4 491 0 61.129.65.176.80 171.250.180.211 ESTABLI...
Have netstat not display port numbers for foreign address
1,426,981,497,000
I have forwarded a port using firewalld, and everything is functioning properly. However, the 'netstat' and 'ss' commands do not display the port opened by firewalld, nor do they show the connections. Since the forwarding is handled at the kernel level, 'netstat' and 'ss' won't reveal the connections or port status. I...
From the point of view of the general networking stack, there is no local connection involved so no associated socket (so ss won't report anything), and as routing requires no associated state, it doesn't have to be known and isn't. But to do NAT, such state must be memorized so all further packets get translated (inc...
How to list the connections of the port forwarded by firewalld?
1,426,981,497,000
I ssh to my ubuntu server and run sudo netstat -a -p and I get this: tcp 0 0 ip-172-31-25-123.us:ssh mailDOTjjtoursDOTcom:54531 ESTABLISHED 1516/sshd: ubuntu [ And when I use my other ssh client, it shows another jjtoursDOTcom in there. I use putty and bitvise. Why does it show that domain name? (I repla...
netstat does a reverse DNS lookup to display a hostname instead of an IP. You can disable reverse DNS lookup with the -n option. Try this: $ sudo netstat -anp
confused by netstat result
1,426,981,497,000
I have some code I'm testing. Program A listens on a predefined socket for program B to connect to and for my testing I'm running 32 instances of the programs A and B. I've written my script to tell program A to listen to port 9001-9032 and put in the configuration files for each instance of program B the correspond...
I recommend to simulate the allegedly broken connections with socat (a command line tool that establish arbitrary byte streams). Try to listen on the ports with socat - TCP-Listen:9001 for a tcp connection that listens on port 9001 or socat - UDP-Listen:9001 for a udp connection. Examine if netstat -p (or alterna...
Netstat shows programs running on different ports then they should
1,426,981,497,000
Under the column "local address" of netstat: 0.0.0.0:22 means that access to port 22 is allowed from any ip addresses. which ip addresses? ip addresses within my local network or outside my local network. if 0.0.0.0:22 refers only to ip addresses within my local network, why I can connect to a server from my home com...
0.0.0.0:22 in local address column means ssh daemon listen on all local ip. So, if you have 2 IPs (say 192.168.0.10 and 90.87.65.123), your ssh daemon will listen on both IPs (and, of course on 127.0.0.1). So you can connect to it with both $ ssh [email protected] $ ssh [email protected] assuming your computer knows ...
what does mean 0.0.0.0:22 under the column local address of netstat command?
1,426,981,497,000
I have a question about linux netstat usage and output results. I'm trying to solve a dilema about why my server is facing communications delays and bottle neck issues, So I started digging and studying and one of the things I needed to know is a full connections list grouped per ip address and count number of stablis...
Well I think you should first understand the command netstat before applying awk and cut in the output. netstat -ntu will display all the udp and tcp connections including tcp6. So when you are trying to apply awk & cut on the output of netstat command netstat -ntu | awk '{print $5}' | cut -d: -f1 the cut command ...
netstat shows over 44K connections without ip address, what's that?