[Ubuntu-BR] Várias redes no Laptop

Bohrer fjbohrer em gmail.com
Sexta Janeiro 4 02:04:11 UTC 2008


Fabiano

Todos os procedimentos abaixo devem ser executados como root.. [ sudo su ]

Basta criar um arquivo dentro de /usr/sbin chamado por exemplo rede..

cd /usr/sbin
> rede

Depois, dê permissão de execução para este arquivo..

chmod 755 rede

Depois cole o conteúdo abaixo no arquivo, adaptando para cada rede
diferente..

# =-=-=-=

#!/bin/bash

cmd=${0##*/}

msg="\n\tUso: $cmd [1] [2] [3]\n\t\t1 = Rede 1\n\t\t2 = Rede 2\n\t\t3 = Rede
3\n"

# =-=-=-=-=-=-=-=-=-=-=
if [ $# -lt 1 ]; then
    echo $msg
    exit 0
fi
# =-=-=-=-=-=-=-=-=-=-=

# =-=-=-=-=-=-=-=-=-=-=
if [ $1 = "3" ]; then
    ifconfig eth0 192.168.1.3 netmask 255.255.255.0
    route add default gw 192.168.1.1
    echo "nameserver 200.184.26.4" > /etc/resolv.conf
# =-=-=-=-=-=-=-=-=-=-=

# =-=-=-=-=-=-=-=-=-=-=
elif [ $1 = "2" ]; then
    ifconfig eth0 10.5.97.2 netmask 255.255.255.252
    route add default gw 10.5.97.1
    echo "nameserver 200.184.26.4" > /etc/resolv.conf
# =-=-=-=-=-=-=-=-=-=-=

# =-=-=-=-=-=-=-=-=-=-=
elif [ $1 = "1" ]; then
    ifconfig eth0 10.3.5.77 netmask 255.255.0.0
    route add default gw 10.3.0.1
    echo "nameserver 10.3.0.12" > /etc/resolv.conf
# =-=-=-=-=-=-=-=-=-=-=

# =-=-=-=-=-=-=-=-=-=-=
else
    echo "Invalid Number" $msg
    exit 0
fi
# =-=-=-=-=-=-=-=-=-=-=

# =-=-=-=

Basta agora adaptar à sua realidade e ir ao terminal e como root, digitar
rede e o parametro [ 1, 2 ou 3 ] de acordo com a configuração escolhida..

Espero que ajude.. em caso de dúvidas, entre em contato..

Um abraço

Bohrer



On Jan 3, 2008 8:13 AM, Davis Cabral - Listas <daviscabral.listas em gmail.com>
wrote:

> Fabiano Fonseca escreveu:
> > Qual é o arquivo de configuração da rede?
> >
> Procura mais informações sobre como usar o comando ifconfig (wired) e
> iwconfig (wifi).
>
> []
>
> Davis
>
> --
> Interessado em aprender mais sobre o Ubuntu em português?
> http://wiki.ubuntu-br.org/ComeceAqui  -
> ubuntu-br mailing list
> ubuntu-br em lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-br
>



-- 
Fernando Bohrer
Linux Registered User # 431341
Ubuntu Registered User # 17430
Linux Professional Institute Certification Level 1 - [LPIC-1]



More information about the ubuntu-br mailing list