Friday, April 26, 2024
26
rated 0 times [  26] [ 0]  / answers: 1 / hits: 72913  / 2 Years ago, mon, december 27, 2021, 12:57:37

I use Juniper Networks (a Java program that establishes a VPN connection).


Does a command exist that lets me check if I'm logged in with Juniper?


More From » command-line

 Answers
4

Route-based VPN or overlay network solutions (with virtual interfaces)


If you run ifconfig -a or ip link show you should be seeing something like tunX below which is a tun device used by most route-based VPN:



# tun device
# used by route-based VPN

tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr: P-t-P: Mask:
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1300 Metric:1
RX packets:10 errors:0 dropped:0 overruns:0 frame:0
TX packets:24 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:1435 (1.4 KB) TX bytes:1677 (1.6 KB)

# Jan 2020 refresh
# sample ifconfig output with 3 virtual interfaces
# for route-based VPN or overlay network

nebula1: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1300
inet 172.16.87.100 netmask 255.255.255.0 destination 172.16.87.100
inet6 fe80::b2c4:4360:a3ae:15aa prefixlen 64 scopeid 0x20<link>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 500 (UNSPEC)
RX packets 37 bytes 2980 (2.9 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 331 bytes 17408 (17.4 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1500
inet 172.16.200.1 netmask 255.255.255.0 destination 172.16.200.1
inet6 fe80::9d2e:5979:5ac2:43df prefixlen 64 scopeid 0x20<link>
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 100 (UNSPEC)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1677 bytes 80496 (80.4 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

wg0: flags=209<UP,POINTOPOINT,RUNNING,NOARP> mtu 1420
inet 172.16.111.100 netmask 255.255.255.0 destination 172.16.111.100
unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 1000 (UNSPEC)
RX packets 37337578 bytes 10884991930 (10.8 GB)
RX errors 0 dropped 67878 overruns 0 frame 0
TX packets 60202096 bytes 66040772964 (66.0 GB)
TX errors 169 dropped 44429 overruns 0 carrier 0 collisions 0



ip link output



5: wg0: <POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1420 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
link/none
6: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 100
link/none
11: nebula1: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1300 qdisc fq_codel state UNKNOWN mode DEFAULT group default qlen 500
link/none


Policy-based VPN (e.g. strongSwan)


Or if you are using IPsec (e.g. strongSwan), ifconfig -a will show a tunnel device (tunX) like below if you are using Route-based mode (default is policy-based):


tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  
inet addr:192.168.11.2 P-t-P:192.168.11.2 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)

If strongSwan is running policy-based routing (default), you'll be able to figure out by manipulating the kernel routing table or looking at ip-xfrm IP framework for transforming packets (encrypting payloads).


# manipulate kernel routing table for more info

ip r
route -nr

ip r show table main
ip r show table local

# strongswan specific table id 220
ip r show table 220

In addition, you can use ip tuntap show to see if there are tun/tap devices to determine if VPN is in use.


    ip tuntap show
tun0: tun

[#34167] Wednesday, December 29, 2021, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
howesale

Total Points: 224
Total Questions: 117
Total Answers: 116

Location: Nauru
Member since Thu, May 18, 2023
1 Year ago
;