Need to create virtual NIC in Ubuntu 18.04 as with Windows 10 have



  • Hi all.

    I am looking for a "loopback interface" as in my windows partition have, i have a pfsense wmware virtualized, the loopback interface gets an ip address from the virtualized pfsense and i can route all trafic to pfsense.

    I have the same scenario in Ubuntu 18.04, since netplan and network manager is managing my wifi and real nic adapter, how i can install a "virtual loopback interface" or "virtual nic" for get an ip address from my virtualized pfsense machine?

    Thanks all!



  • I have set a dummy interface:

    ip li add dummy0 type dummy

    Then i have bridged vmware vmnet2 to dummy0, now when i do "dhclient dummy0" i receive IP from pfsense.

    But when i ping to pfsense firewall all packets are loss 100 %

    why?



  • These are Linux and VMware questions that have nothing to do with pfSense specifically. Maybe a VMware forum would be more useful to you.



  • @oscar77 said in Need to create virtual NIC in Ubuntu 18.04 as with Windows 10 have:

    But when i ping to pfsense firewall all packets are loss 100 %
    why?

    Did you try to ping ubuntu from pfsense?
    What is the output in ubuntu of
    ip route



  • @gjaltemba thx for your response.

    I finally solve it, i'm using this script:

    #!/bin/bash

    Setup network namespace with veth pair, start xterm in it

    nsterm ns0 veth0 10.0.0 yellow 24

    if [[ $EUID -ne 0 ]]; then
    echo "This script must be run as root" 1>&2
    exit 1
    fi

    NS=${1:-ns0}
    DEV=${2:-veth0}
    DEV_A=${DEV}a
    DEV_B=${DEV}b
    ADDR=${3-:10.0.0}
    ADDR_A=${ADDR}.254
    ADDR_B=${ADDR}.1
    MASK=${5:-24}
    COL=${4:-yellow}

    echo ns=$NS dev=$DEV col=$COL mask=$MASK

    ip netns add $NS
    ip link add $DEV_A type veth peer name $DEV_B netns $NS
    ip addr add $ADDR_A/$MASK dev $DEV_A
    ip link set ${DEV}a up
    ip netns exec $NS ip addr add $ADDR_B/$MASK dev $DEV_B
    ip netns exec $NS ip link set ${DEV}b up
    ip netns exec $NS ip route add default via $ADDR_A dev $DEV_B
    ip netns exec $NS su -c "xterm -bg $COL &" USER

    When i do "dhclient veth0a" i receive ip address from pfsense, and i can finally route all traffic throught pfsense