Force-Ipv4

These scenarios demonstrate how to use telnet with IP family forcing parameters (force-ipv4 and force-ipv6) to control which IP protocol version is used for the connection. The tests validate proper error handling when there is a mismatch between the forced protocol and the actual IP address format.

Telnet Force IPv4 with IPv4 Address Success

Description

This test demonstrates that using force-ipv4 parameter with an IPv4 address works correctly and establishes a successful telnet connection. After forcing IPv4 protocol with a matching IPv4 address, the connection proceeds normally through the standard login flow and authentication.

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 10.215.168.20/24
set service telnet
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 2: Set the following configuration in DUT1 :

set interfaces ethernet eth0 address 10.215.168.21/24
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Ping IP address 10.215.168.20 from DUT1:

admin@DUT1$ ping 10.215.168.20 count 1 size 56 timeout 1
Show output
PING 10.215.168.20 (10.215.168.20) 56(84) bytes of data.
64 bytes from 10.215.168.20: icmp_seq=1 ttl=64 time=0.417 ms

--- 10.215.168.20 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.417/0.417/0.417/0.000 ms

Step 4: Init a Telnet connection from DUT1 to IP address 10.215.168.20 using force-ipv4 :

admin@DUT1$ telnet 10.215.168.20 force-ipv4
Show output
Trying 10.215.168.20...
Connected to 10.215.168.20.
Escape character is '^]'.

Linux 6.1.140 (osdx) (pts/0)

osdx login:
Password:

Welcome to Teldat OSDx v4.2.8.1

This system includes free software.
Contact Teldat for licenses information and source code.

Last login: Thu Dec 11 18:33:21 UTC 2025 from ::ffff:10.215.168.25 on pts/0
admin@osdx$

Telnet Force IPv6 with IPv4 Address Should Fail

Description

This test demonstrates that using force-ipv6 parameter with an IPv4 address results in a Server lookup failure error due to address family mismatch. The telnet command attempts to force IPv6 protocol but the provided address is IPv4, causing the connection to fail as expected.

Scenario

Step 1: Set the following configuration in DUT0 :

set interfaces ethernet eth0 address 10.215.168.20/24
set service telnet
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 2: Set the following configuration in DUT1 :

set interfaces ethernet eth0 address 10.215.168.21/24
set system login user admin authentication encrypted-password '$6$GSjsCj8gHLv$/VcqU6FLi6CT2Oxn0MJQ2C2tqnRDrYKNF8HIYWJp68nvXvPdFccDsT04.WtigUONbKYrgKg8d6rEs8PjljMkH0'

Step 3: Ping IP address 10.215.168.20 from DUT1:

admin@DUT1$ ping 10.215.168.20 count 1 size 56 timeout 1
Show output
PING 10.215.168.20 (10.215.168.20) 56(84) bytes of data.
64 bytes from 10.215.168.20: icmp_seq=1 ttl=64 time=0.383 ms

--- 10.215.168.20 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.383/0.383/0.383/0.000 ms

Step 4: Init a Telnet connection from DUT1 to IP address 10.215.168.20 which is going to fail using force-ipv6 :

admin@DUT1$ telnet 10.215.168.20 force-ipv6
Show output
Server lookup failure:  10.215.168.20:telnet, Address family for hostname not supported
  CLI Error: Command error
admin@osdx$