Lets learn "How to optimise TCP/IP setting in linux"

 

Optimising TCP/IP setting in Linux

In this post, we are going to tell you some of the tips usually applied in Linux to increase the efficiency of networking modules in it. Before going through these procedures, if you want to know basics of what actually is happening, you better go through this basic tutorial on networking.
 Also many a times in Ubuntu, it happens that while experimenting on new settings, the system crashes or start behaving abnormally or may be even get exempted from proper booting. To deal with this, I recommend you, to go this this Great tutorial as well
 One last word: Much of these settings are much depended on what is your hierarchical position inside a network and what were your intermediate router settings. This tutorial doesn't gives you any basics on how to increase your bandwidth(may be next tutorial), but may help you in several other ways

  • May increase your surfing speed.
  • May suppress the effect of noise ping generated on network.
  • May benefit to some extend while playing online (due to suppressed noise)
The biggest disadvantage of this is
  • You may lose internet connectivity(due to some erroneous parameter values)
  • Your Security parameters may get weaken and your system may become prone to cyber attacks.
These are of course temporary problems, Now lets start.
Note that the Ubuntu networking Module is volatile i.e settings are updated from module parameter's location every time we boot. So, we need to manually save all the settings to make it permanent.
To test your settings after you tweak you type
$ sysctl -p # For changes to take place
for change to take place. Every parameter we are going to work on is present in folder proc/sys/net/... This contains some files which contains parameters whose values describe how your PC's Internet works. When we change these parameters to we have to restart out networking module; procedure of which is shown at last.
  • ipv4/tcp_rmem - tuple of 3 values showing min, default and max values of amount of data it can store at receiving end (Buffering)
  • ipv4/tcp_wmem - tuple of 3 values showing min, default and max values of amount of data it can store at sending end (Buffering)
  • core/rmem_max - How much data the receiving computer is prepared to get at one time.
  • core/wmem_max - How much data the sending computer is prepared to send at one time.
  • ipv4/tcp_timestamps - Weather to put Timestamp inside packets. Helps for packets recovery.
  • ipv4/tcp_sack - Weather to put selective acknowledgements.
  • ipv4/tcp_window_scaling - Needs to be set to 1 if the Max TCP Window is over 65535. Tcp window support.
To see your default setting relating to these parameters type
$ sysctl -a #gives list of all network paramters and there values
Change values in file names given left side with values on right hand side. Parameters to set

File NameValue
/proc/sys/net/ipv4/tcp_fin_timeout30
/proc/sys/net/ipv4/tcp_keepalive_intvl30
/proc/sys/net/ipv4/tcp_keepalive_probes5
/proc/sys/net/ipv4/tcp_tw_recycle1
/proc/sys/net/ipv4/tcp_tw_reuse1


One more tweak you can make to set your value of MTU(Maximum transfer Unit).
MTU - Amount of data that can be transferred in one physical frame on the network.
You can change this value by use of
$ ifconfig eth0 mtu 1500 #1500 is the max size of MTU

At last go for 
$ sysctl -p 
for changes to take place.

After these procedures, you may find the effect of traffic in your network would have less effects on your intranet as well as internet tasks.

Feel free to make changes inside these files as long as you understand how to recover from a system crash. Good Luck. Comment if you have any doubts 

Comments

Popular posts from this blog

Lets learn "About kube proxy in iptables mode"

Lets learn "System design for paste bin (or any text sharing website)"

Lets learn "What is CDN?"