is there any way to set the system TCP KeepAliveTimeout in Windows 10?
In linux it is possible to do this thing by the following command:
echo 60 > /proc/sys/net/ipv4/tcp_keepalive_time
This command establishes a 60 second timeout for all connections.
I will appreciate any help
I tried creating the variable 'KeepAliveTime' in:
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Tcpip\Parameters
But it doesn't work.
Related
How do I ping for 60 seconds in CMD?
ping www.google.com -t60
Doesn't works.
The command is working but not as you wanted since -t flag is for continuous ping unless stopped.
I think this ping feature you are looking for is available in Linux
It uses -i flag for interval from what I recall.
Short version of question is: How to tune\configure macOS (Mojave 10.14.3) settings to allow more then 10k outgoing TCP connections per process and more then 16k connections in total.
Details:
I'm trying to make MacBookPro (16Gb RAM, Core i7) usable for stress-testing tcp server. Server itself hosted on separate pc, so right now the question is about outgoing connections only.
Below advices already processed and helped me significantly increase initial os limits.
1) I used [launchctl] ("Too many open files" when executing gatling on Mac) to increase maxfiles limit to 1 million.
2) I used sysctl to set\check kern.maxfiles limits. Actually (as I understand) this is the same as #1.
3) I played with ulimit. Actually I didn't notice any effect of this tool on my OS. But any way...
So now I MacOS can establish ~10k connections per process and 16k total connections in the system.
For simplicity my tool just open TCP connections in a infinite loop and waits.
try
{
while (true)
{
CreateAndConnectSocket(); //add socket to list
++connectedSockets;
}
}
catch(Exception e)
{
LogWrite("Connected sockets:" + connectedSockets);
LogWrite(e);
WaitForAnyKey();
}
Then I follow below steps.
1) Launch server on separate PC.
2) Open two terminals on mac.
3) Execute in first terminal window:
$ sudo launchctl limit maxfiles 1048576 1048600
$ ulimit -S -n 1048576
4) Verify that changes applied in first terminal:
$ ulimit -S -n
1048576
$ launchctl limit maxfiles
maxfiles 1048576 1048600
$ sysctl kern.maxfilesperproc
kern.maxfilesperproc: 1048576
$ sysctl kern.maxfiles
kern.maxfiles: 1048600
5) Launch "ulimit -S -n 1048576" in second terminal (Not sure that ulimit is required at all.)
6) Verify that all changes applied in second terminal window (same as #4).
7) Launch "test client" in first terminal.
8) Launch "test client" in second terminal.
Result:
After step 7 in first terminal I can see, that tool opened 10k connections (10202 to be precise) and fell down with exception "Too many open files in system". Have no idea why opened files is an issue with 1 million limit.
After step 8 in second terminal I can see that tool opened 6k connectoins and fell down with exception "Can't assign requested address".
While sockets remain opened (tools wait for key press), no other connections can be created in the system - browsers can't establish connections to google.com, etc.
And ofcourse tcp server remains accessible from another PCs.
Since I was able to tune "Windows 10 Home" for higher connection numbers, I believe that MacOS can be tuned too.
16383 TCP connections (from the same IP to the same port) is the limit imposed by default in MacOs (at least in Mojave).
This limit is defined by the ephemeral port range:
$ sudo sysctl net.inet.ip.portrange
net.inet.ip.portrange.lowfirst: 1023
net.inet.ip.portrange.lowlast: 600
net.inet.ip.portrange.first: 49152
net.inet.ip.portrange.last: 65535
net.inet.ip.portrange.hifirst: 49152
net.inet.ip.portrange.hilast: 65535
By default the range starts from 49152 (net.inet.ip.portrange.first) and ends to 65535 (net.inet.ip.portrange.last). That is, 65535 - 49152 = 16383.
You can make the ephemeral port range starting from 32768:
sudo sysctl -w net.inet.ip.portrange.first=32768
This way you double the available ephemeral ports (65535 - 32768 = 32767).
all
The cluster system is constructed using the Perceus program. (scientific linuxs 6.9)
I installed condor in the vnfs file.
After this, when I make an ssh connection, I get a problem that ssh connection is disconnected after 10 minutes. The command is not recognized as shown below.
ssh was not disconnected before installing condor. However, we confirmed that pinging is done without loss.
how could fix this problem? Please suggest a solution
enter image description here
Can you go to this directory to edit ssh file
cd /etc/ssh/sshd_config
change
ClientAliveInterval 120
ClientAliveCountMax 720
This will make the server send the clients a “null packet” every 120 seconds and not disconnect them until the client have been inactive for 720 intervals (120 seconds * 720 = 86400 seconds = 24 hours).
Using sudo ping -f (URL) on a Mac gives the message:
Request timeout for icmp_seq as a reply.
How can I fix this?
The reply means the target host is unreachable which is not an error and can happen using a plain 'ping' as well.
Now, using the -f(lood) option, some firewalls or hosts can believe it's a DoS attack and drop the icmp packets silently.
Do you really need this -f option ? It can overflow the network and should be avoided as much as possible.
I'm downloading huge sums of data at night and my PC in running through a UPS. Is there any way I can detect a power failure and command my PC to shut down automatically? Because I work at night, and there's no one to switch off the PC, it would be really helpful if anyone could help. Is it possible?
Thanks.
IMPORTANT: The scripts presented below will cause the system to shutdown whenever the network is down, so use them at your own risk!
A not so elegant way of doing what you want, if you have a network host (e.g. your router) that responds to ICMP echo requests and is not powered by the UPS (or at least the networking equipment is not powered by the UPS), would be to ping that host every few seconds and if it's down then shutdown the PC:
#!/bin/bash
while :
do
ping -c 1 -w 5 192.168.0.1 &> /dev/null
if [ $? -gt 0 ]; then
shutdown -hP now
break
fi
sleep 10s
done
You will have to change 192.168.0.1 to the IP address of the network host you want to ping.
You will also have to make the script executable with chmod +x <script_name> and place a call to it in /etc/rc.local (do not forget to append a & to make it run in the background) which will run the script as root on boot.
For completeness' sake, if the PC was running Windows XP one could use the following batch file:
:loop
ping -n 1 -w 5000 192.168.0.1
if not %ERRORLEVEL% == 0 (
shutdown -s
goto end
)
sleep 10
goto loop
:end
Note that the Windows batch file requires the sleep command which can be installed as part of the Windows Server 2003 Resource Kit Tools package (available as a free download from Microsoft's site)
If it's an APC and it has a data port you can use PowerChute. It's a java-based GUI (which could be a problem if this is your server) that does exactly what you are requesting.