def device=(veth)
      sudo "ip link set dev #{veth} netns #{name}"

      vlan_suffix = @vlan ? ".#{@vlan}" : ''
      if @vlan
        sudo "ip netns exec #{name} ip link set #{veth} up"
        sudo "ip netns exec #{name} "\
             "ip link add link #{veth} name "\
             "#{veth}#{vlan_suffix} type vlan id #{@vlan}"
      end
      if @mac_address
        sudo "ip netns exec #{name} "\
             "ip link set #{veth}#{vlan_suffix} address #{@mac_address}"
      end
      sudo "ip netns exec #{name} ip link set #{veth}#{vlan_suffix} up"
      sudo "ip netns exec #{name} "\
           "ip addr replace #{@ip_address}/#{@netmask} "\
           "dev #{veth}#{vlan_suffix}"
      sudo "ip netns exec #{name} ip link set #{veth}#{vlan_suffix} up"

      @route.add name
    end
def device=(veth)
      sudo "ip link set dev #{veth} netns #{name}"

      vlan_suffix = @vlan ? ".#{@vlan}" : ''
      if @vlan
        sudo "ip netns exec #{name} ip link set #{veth} up"
        sudo "ip netns exec #{name} "\
             "ip link add link #{veth} name "\
             "#{veth}#{vlan_suffix} type vlan id #{@vlan}"
      end
      if @mac_address
        sudo "ip netns exec #{name} "\
             "ip link set #{veth}#{vlan_suffix} address #{@mac_address}"
      end
      sudo "ip netns exec #{name} ip link set #{veth}#{vlan_suffix} up"
      sudo "ip netns exec #{name} "\
           "ip addr replace #{@ip_address}/#{@netmask} "\
           "dev #{veth}#{vlan_suffix}"
      sudo "ip netns exec #{name} ip link set #{veth}#{vlan_suffix} up"

      @route.add name
    end
rubocop:disable MethodLength
 rubocop:disable AbcSize