preferring wired over wireless - Debian

This is a discussion on preferring wired over wireless - Debian ; When both my wireless and wired networking devices are connected, how can I get my laptop to use the wired device and ignore the wireless one? I tried specifying a higher metric for my wired device (via ifconfig metric), but ...

+ Reply to Thread
Results 1 to 8 of 8

Thread: preferring wired over wireless

  1. preferring wired over wireless

    When both my wireless and wired networking devices are connected, how can I
    get my laptop to use the wired device and ignore the wireless one? I tried
    specifying a higher metric for my wired device (via ifconfig metric), but it
    doesn't seem to have an effect.

    Luca


    --
    To UNSUBSCRIBE, email to debian-laptop-REQUEST@lists.debian.org
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

  2. Re: preferring wired over wireless

    On Saturday 05 November 2005 12:50 pm, Luca Pireddu wrote:
    > When both my wireless and wired networking devices are connected, how can I
    > get my laptop to use the wired device and ignore the wireless one? I tried
    > specifying a higher metric for my wired device (via ifconfig metric), but
    > it doesn't seem to have an effect.


    ip route del default
    ip route add default via

    David


    --
    To UNSUBSCRIBE, email to debian-laptop-REQUEST@lists.debian.org
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

  3. Re: preferring wired over wireless

    Luca Pireddu wrote:

    >When both my wireless and wired networking devices are connected, how can I
    >get my laptop to use the wired device and ignore the wireless one? I tried
    >specifying a higher metric for my wired device (via ifconfig metric), but it
    >doesn't seem to have an effect.
    >
    >Luca
    >
    >
    >
    >


    Luca,

    There are several ways of doing this. One is change the routing table
    and another is turn off the wireless card.

    Remove entry in routing table
    1. check routing table
    route -n
    2. remove gateway line for wireless card
    route del default gw 44.44.44.44 dev ethX

    Turn off wireless card
    ifconfig ethX down

    Cheers
    -Mark


    --
    To UNSUBSCRIBE, email to debian-laptop-REQUEST@lists.debian.org
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

  4. Re: preferring wired over wireless

    Luca Pireddu hat geschrieben:

    >When both my wireless and wired networking devices are connected, how can I
    >get my laptop to use the wired device and ignore the wireless one? I tried
    >specifying a higher metric for my wired device (via ifconfig metric), but it
    >doesn't seem to have an effect.


    You could trying to set the default-route over the wired interface:

    #route add --net v.w.y.z/n ethx

    Cheers,
    --
    |¯¯¯\ |¯| |¯| |¯| |¯| |¯| |¯¯¯\|¯¯¯\ |¯¯¯¯¯| ascii158@web.de (valid,
    | |_| | `-´ | | | | | | | | |_|| |_| ¯| |¯ but filtered strictly)
    | | | ,-. | | | | |_ | | | | | | | | ICQ:117362083
    |_| |_| |_| |_| |___||_| |_| |_| |_| O Germany


    --
    To UNSUBSCRIBE, email to debian-laptop-REQUEST@lists.debian.org
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

  5. Re: preferring wired over wireless

    Am Samstag, 5. November 2005 21:50 schrieb Luca Pireddu:
    > When both my wireless and wired networking devices are connected, how can I
    > get my laptop to use the wired device and ignore the wireless one? I tried
    > specifying a higher metric for my wired device (via ifconfig metric), but
    > it doesn't seem to have an effect.


    Use a different metric (man interfaces):

    default via 192.168.0.1 dev eth0
    default via 192.168.1.1 dev ath0 metric 10

    Here you can see two default routes, but the one with the lower metric is
    preferred.

    regards,
    Jörg


    --
    To UNSUBSCRIBE, email to debian-laptop-REQUEST@lists.debian.org
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

  6. Re: preferring wired over wireless

    On Sat, 2005-11-05 at 13:50 -0700, Luca Pireddu wrote:
    > When both my wireless and wired networking devices are connected, how canI
    > get my laptop to use the wired device and ignore the wireless one? I tried
    > specifying a higher metric for my wired device (via ifconfig metric), butit
    > doesn't seem to have an effect.


    The normal way is to use one of the packages for detecting and setting
    interfaces so that it only leaves the appropriate one configured.

    I maintain 'whereami', which works this way, but there are plenty of
    other choices.

    Cheers,
    Andrew.

    -------------------------------------------------------------------------
    Andrew @ Catalyst .Net .NZ Ltd, PO Box 11-053, Manners St, Wellington
    WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St
    DDI: +64(4)803-2201 MOB: +64(272)DEBIAN OFFICE: +64(4)499-2267
    Make things as simple as possible, but no simpler -- Einstein
    -------------------------------------------------------------------------


    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.1 (GNU/Linux)

    iD8DBQBDbT0ljJA0f48GgBIRAu3KAJ0YhndDnrMFkmFvcTelDC x1sx6LnACfSzw4
    wsJv9FGAPZb5vzx+B++hMTo=
    =ZNQ6
    -----END PGP SIGNATURE-----


  7. Re: preferring wired over wireless

    Le 13092ième jour après Epoch,
    Luca Pireddu écrivait:

    > When both my wireless and wired networking devices are connected, how canI
    > get my laptop to use the wired device and ignore the wireless one? I tried
    > specifying a higher metric for my wired device (via ifconfig metric), butit
    > doesn't seem to have an effect.


    If both interfaces are on same network, metric can't help you... You
    must use "ip rule" and "ip route" without default route to solve your
    problem.

    man ip

    and contact me (us) again if you have problems.

    For example:

    # eth1 = wired
    # eth2 = wireless

    /sbin/ip rule add prio 50 table main
    /sbin/ip route del default table main

    /sbin/ip rule add prio 201 from /32 table 201
    /sbin/ip route add default via dev eth1 src proto static table 201
    /sbin/ip route append prohibit default table 201 metric 1 proto static

    /sbin/ip rule add prio 202 from /32 table 202
    /sbin/ip route add default via dev eth2 src proto static table 202
    /sbin/ip route append prohibit default table 202 metric 1 proto static

    /sbin/ip rule add prio 222 table 222
    /sbin/ip route add default table 222 proto static nexthop via dev eth1 weight 2 nexthop via dev eth2 weight 1

    --
    Un groupe de loups, c'est une horde. Un groupe de vaches, c'est un
    troupeau. Un groupe d'hommes, c'est souvent une bande de cons.
    -+- Philippe Geluck, Le chat -+-

  8. Re: preferring wired over wireless

    On Saturday 05 November 2005 16:06, François TOURDE wrote:
    > Le 13092ième jour après Epoch,
    >
    > Luca Pireddu écrivait:
    > > When both my wireless and wired networking devices are connected, how can
    > > I get my laptop to use the wired device and ignore the wireless one? I
    > > tried specifying a higher metric for my wired device (via ifconfig
    > > metric), but it doesn't seem to have an effect.

    >
    > If both interfaces are on same network, metric can't help you... You
    > must use "ip rule" and "ip route" without default route to solve your
    > problem.


    That would explain the behaviour I was seeing.

    >
    > man ip
    >
    > and contact me (us) again if you have problems.
    >
    > For example:
    >
    > # eth1 = wired
    > # eth2 = wireless
    >
    > /sbin/ip rule add prio 50 table main
    > /sbin/ip route del default table main
    >
    > /sbin/ip rule add prio 201 from /32 table 201
    > /sbin/ip route add default via dev eth1 src
    > proto static table 201 /sbin/ip route append prohibit default table 201
    > metric 1 proto static
    >
    > /sbin/ip rule add prio 202 from /32 table 202
    > /sbin/ip route add default via dev eth2 src
    > proto static table 202 /sbin/ip route append prohibit default
    > table 202 metric 1 proto static
    >
    > /sbin/ip rule add prio 222 table 222
    > /sbin/ip route add default table 222 proto static nexthop via
    > dev eth1 weight 2 nexthop via dev eth2
    > weight 1


    Thanks for the tip on using routing rules and your example. I think I have a
    solution (it seems to work!). I'll post it here in case anyone is
    interested.

    I wrote these two little scrips:

    1. route_up

    #!/bin/sh

    set +e

    if [ $IFACE == "eth0" ]; then
    # wired
    table=201
    priority=50
    elif [ $IFACE == "eth1" ]; then
    # wireless
    table=202
    priority=100
    fi

    ip rule add priority $priority table $table
    ip route add default via $IF_GATEWAY dev $IFACE proto static table $table

    exit 0

    -------------------------------------------------
    2. route_down

    #!/bin/sh

    set +e

    if [ $IFACE == "eth0" ]; then
    # wired
    table=201
    elif [ $IFACE == "eth1" ]; then
    # wireless
    table=202
    fi

    ip rule delete table $table

    exit 0
    -----------------------------------------------------

    I placed route_up in /etc/network/if-up.d and route_down
    in /etc/network/if-post-down.d. Because of the differing priorities of the
    wired and wireless rules, the system always chooses the wired connection when
    they're both up---all without any manual intervention :-)

    Thanks for all the replies. I appreciate your help.

    Luca


    --
    To UNSUBSCRIBE, email to debian-laptop-REQUEST@lists.debian.org
    with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

+ Reply to Thread