vishvananda / netlink

Simple netlink library for go.
Apache License 2.0
2.88k stars 748 forks source link

What will be the equivalent command of: ip tuntap add tap0 mode tap? #799

Open santosh opened 2 years ago

santosh commented 2 years ago

I am trying to configure a tap device on my host. I am compelled to use Golang for it. How can I run a new tap device?

If I were using command line, I would run this:

ip tuntap add tap0 mode tap
pujianto commented 1 year ago
device := &netlink.Tuntap{
        Mode: netlink.TUNTAP_MODE_TAP,
        LinkAttrs: netlink.LinkAttrs{
            Name: 'deviceName',
        },
    }

sudo required