How to create Virtual Network Interface on Android

3,736 views
Skip to first unread message

Te-Yuan Huang

unread,
Feb 21, 2011, 4:38:03 AM2/21/11
to Android Linux Kernel Development
Hi all,
(posted a similar post on android-platform, but maybe android-kernel
is a more suitable for this question )

I would like to create a virtual network interface on android, just
like usb0 or rmnet0/1/2.
I tried to follow the traditional way on linux, that is: "ip link add
type veth".
Therefore, I cross-compiled busybox, and it works fine on andoird.
However, when I try to execute "busybox ip link add type veth",
kernel complains: "ip: RTNETLINK answers: Operation not supported"

I checked the kernel configuration, all the modules needed by iproute2
are included.
I.e.:
CONFIG_NETFILTER_NETLINK=y
CONFIG_NETFILTER_NETLINK_QUEUE=y
CONFIG_NETFILTER_NETLINK_LOG=y
CONFIG_NF_CT_NETLINK=y
CONFIG_SCSI_NETLINK=y
CONFIG_IP_ADVANCED_ROUTER=y
CONFIG_NET_SCH_INGRESS=y
CONFIG_NET_SCHED=y
IP_MULTIPLE_TABLES=y
NETFILTER_XT_TARGET_MARK=y

Can anyone shed me some light on this?
Have been stuck here for a few days.

Many Thanks,
Te-Yuan

Te-Yuan Huang

unread,
Feb 22, 2011, 3:24:05 PM2/22/11
to Android Linux Kernel Development
I solved this problem, and for others' reference:

The veth device driver is not included in android kernel as default,
thus, one needs to included it in order for 'ip link add type veth' to work

To be more specific, set
CONFIG_VETH=y

then everything will work.

-Te-Yuan

> --
> unsubscribe: android-kerne...@googlegroups.com
> website: http://groups.google.com/group/android-kernel

Reply all
Reply to author
Forward
Message has been deleted
0 new messages