Check TTL on Linux router

Make Linux a router and make sure the IP packet TTL is working

IP packet TTL (Time to Live) is to prevent infinite transfer. When passing through a subnet (router), it is decremented (value is decremented by 1). Here, set the router on Linux and check the operation of TTL.

Network configuration


As usual, we use VirtualBox to create such a configuration. See here for an example of VirtualBox settings.

Linux router settings

With the above configuration, there is no need to set Static Route. Just enable Forwarding (net.ipv4.ip_forward).

~# sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 0
~# sysctl -w net.ipv4.ip_forward=1
net.ipv4.ip_forward = 1


Part 1

Ping from terminal 2 ( to terminal 1 ( At this time, set the TTL to 10 (-t option).

~# ping -t 10
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=63 time=0.691 ms

It seems that the default of ttl is usually 64. The TTL decrement can also be confirmed with the reply packet "ttl = 63", but here, the state of "TTL = 10" at the time of transmission is confirmed with the packet capture data. Click here for the captured data on the sending side (terminal 2). TTL=10.png Click here for the captured data on the receiving side (terminal 1). TTL=9.png As expected, it is decremented as "TTL = 9".

Part 2

Set to "TTL = 1".

~# ping -t 1
PING ( 56(84) bytes of data.
From icmp_seq=1 Time to live exceeded

The TTL was decremented by the router, and it became '0', making the packet unreachable.

At the end

I confirmed that it can be a router even on Linux. Is it natural?

Recommended Posts

Check TTL on Linux router
NAT router on Linux
Check capacity on Linux
Status check command used (sometimes) on linux
[2020July] Check the UDID of the iPad on Linux
jblas on Arch Linux
Check Linux kernel version
Develop .NET on Linux
Wake on lan on Linux
Monitor traffic on Linux
Update vscode on linux
Try NeosVR on Linux
LiveUSB creation on Linux
Linux operation on Win10
Check if the LAN cable is disconnected on Linux
NTP configuration memo on Linux
Install Linux on your Chromebox
Monitor disk usage on Linux
Use Github Desktop on Linux
Elixir = Comfortable on Linux Mint
Read core voltage on Linux
Put jenv on Amazon Linux
Easy df command on Linux
Linux on Windows -1-: debian introduction
Install tomcat 5.5 on Amazon Linux.
Introducing Elixir on Linux Mint
Use sshpass on Amazon linux2
Install Homebrew on Amazon Linux 2
Paste the link on linux
Install strongSwan 5.9.1 on Amazon Linux 2
Linux environment construction (on WSL environment)
Linux PC spec check command
Run FreeBSD on Linux + qemu
Use Linux on Windows 10 (WSL2)
Setting up OpenSSH on Arch Linux
Use host.docker.internal on linux (docker-compose required)
Install Python Pillow on Amazon Linux
Easy copy to clipboard on Linux
Try installing OpenAM on Amazon Linux
WSL2 ~ Linux on Windows ~ (Part 1: Introduction)
Install CUDA on Linux Mint Mate 20
Install Arch Linux on DeskMini A300
Run a Linux server on GCP
How to install VMware-Tools on Linux
View disk usage on personal Linux
Install pyenv on EC2 (Amazon Linux)
[Linux] I installed CentOS on VirtualBox
Enjoy edge computing on Alpine Linux
Rip Music CDs on Arch Linux
Create a Linux environment on Windows 10
Make Live USB on Alpine Linux
[Linux] Docker environment construction on Redhat
Use Chrome Remote Desktop on Linux
[Note] Install Imagick on Amazon Linux2
[Note] Run Django on Amazon Linux 2
How to check Linux OS version
Run docker-compose on Amazon Linux2 on ARM64
Introduce Python 3.5.2 environment on Amazon Linux
pykintone on Windows Subsystem for Linux
Find large files / directories on Linux
python> os.path.join ('data','checkpoint')>'data / checkpoint' on linux