Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am trying to capture packets on a tun interface with libpcap. I am creating the interface with:

openvpn --mktun --dev tun0

When the adapter is setup it appears as so when I run ifconfig:

tun0      Link encap:UNSPEC  HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
          POINTOPOINT 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:100
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

The adapter needs to be running in order for libpcap to detect the packets:

POINTOPOINT NOARP RUNNING MULTICAST  MTU:1500  Metric:1

Is there any way to force the tun interface to be running so I can capture packets on it?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

If by running you mean "up", the command is:

ip link set dev tun0 up
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.