[Suse93] Laptop & verschillende netwerken: hoe wisselen?

Pagina: 1
Acties:

  • LePlatDuJour
  • Registratie: April 2002
  • Laatst online: 10-02 10:18

LePlatDuJour

Fighting entropy since 1970

Topicstarter
Goeie,

Ik ben erg happy met m´n Delletje D800, behalve dan dat de wifi kaart (een :X:X broadcom) het nog niet echt wil doen, maar daar gaat ´t ff niet om. Waar het wel om gaat: ik gebruik deze laptop in verschillende netwerken, en ik vraag me af hoe ik snel en gemakkelijk kan wisselen tussen bijvoorbeeld:

- thuis -
vast ip adres, vaste dns server, nfs mount point naar server

- werk 1 -
dhcp adres

- werk 2 -
dhcp adres met vaste dns servers

Ik zit nu steeds te wisselen met YaST, maar is daar niet een tooltje voor? Ik gebruik SuSE 9.3 met KDE. Oh, en ik ben nog een linux n00bje..

What use is a man walking on water if you don't follow in his footsteps?


  • Super_ik
  • Registratie: Maart 2001
  • Laatst online: 09:19

Super_ik

haklust!

en als we toch bezig zijn :P
-werk1-
proxy settings 1

-werk2-
proxy settings 2

-thuis-
geen proxy

ik gebuik slack, en pas t elke keer aan in firefox.

[ Voor 3% gewijzigd door Super_ik op 22-07-2005 09:46 ]

8<------------------------------------------------------------------------------------
Als ik zo door ga haal ik m'n dood niet. | ik hou van goeie muziek


  • LePlatDuJour
  • Registratie: April 2002
  • Laatst online: 10-02 10:18

LePlatDuJour

Fighting entropy since 1970

Topicstarter
Om mijn eigen vraag maar ff te beantwoorden (voor ´t nageslacht..): YaST > System > Profile Manager!

What use is a man walking on water if you don't follow in his footsteps?


  • Super_ik
  • Registratie: Maart 2001
  • Laatst online: 09:19

Super_ik

haklust!

iemand een oplossing die
1) ook voor andere distros werkt
2) geen X vereist.

8<------------------------------------------------------------------------------------
Als ik zo door ga haal ik m'n dood niet. | ik hou van goeie muziek


  • Robtimus
  • Registratie: November 2002
  • Laatst online: 10-02 18:41

Robtimus

me Robtimus no like you

Ligt eraan waar de config bestanden staan.
Onder RedHat / Fedora was dat geloof ik /etc/sysconfig/network-scripts/ifcfg-eth0 voor eth0. Die kun je handmatig aanpassen waarna je wel je eth0 moet downen en uppen.

Thuis heb ik daar een script voor op mijn laptop, om te wisselen tussen vast IP en DHCP, maar daar kan ik niet zo snel bij. Wat het iig deed: aan de hand van parameters kopieerde het een vooraf ingestelde config over die ifcfg-eth0 heen, ifup en ifdown. Aanroep was simpel: giveIP dhcp | local | dyndns (om ook mijn Dyndns account te updaten).

Als ik thuis kom zal ik er eens naar kijken, maar de plek van het netwerk script is van groot belang.

More than meets the eye
There is no I in TEAM... but there is ME
system specs


  • Robtimus
  • Registratie: November 2002
  • Laatst online: 10-02 18:41

Robtimus

me Robtimus no like you

Zoals beloofd:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh

# version 2.1
#
# exported updating ipcheck part to an external executable

# path where the ifcfg-eth0 scripts are kept
IESPATH=/root/.netscripts

# path where the ifcfg-eth0 scripts are to be copied to
NETPATH=/etc/sysconfig/network-scripts

# restart PCMCIA and sleep
pcmciarestart() {
    /etc/init.d/pcmcia restart
    sleep 3    
}

dhcpup() {
    cp -f $IESPATH/dhcp $NETPATH/ifcfg-eth0
    ifup eth0
}

localup() {
    cp -f $IESPATH/none $NETPATH/ifcfg-eth0
    ifup eth0
}

printerror() {
  echo "Usage: giveIP [pcmcia] [dyndns | dhcp | local]"
}

# if $# = 0 then just ifup eth0 (netconf settings)
# if $# = 1 then
#    if $1 = 'pcmcia' then just ifup eth0 after pcmcia restart
#    if $1 = 'dyndns' then use 'dhcp' file and request DYNDNS dynamic alias
#    if $1 = 'dhcp' then use 'dhcp' file
#    if $1 = 'local' then use 'none' file
#    else ERROR
# if $# = 2 then
#    $1 should be pcmcia
#    $2 should be one of 'dyndns', 'dhcp', 'local'
#    else ERROR
# else ERROR

case $# in
  0) ifup eth0 ;;
  1) case $1 in
       pcmcia) pcmciarestart
               ifup eth0 ;;
       dyndns) dhcpup
               updatedns ;;
       dhcp) dhcpup ;;
       local) localup ;;
       *) printerror
          exit 1 ;;
     esac ;;
  2) case $1 in
       pcmcia) case $2 in
                 dyndns) pcmciarestart
                         dhcpup
                         updatedns ;;
                 dhcp) pcmciarestart
                       dhcpup ;;
                 local) pcmciarestart
                        localup ;;
                 *) printerror
                    exit 1 ;;
               esac ;;
       *) printerror
          exit 1 ;;
     esac ;;
  *) printerror
     exit 1 ;;
esac
Dat pcmcia deel was soms nodig met de cardbus kaart die in die laptop zit, maar nu is het geloof ik alweer overbodig. updatedns is een script dat ik in /sbin heb staan.

De 2 scripts zijn vrijwel identiek, hier alleen de DHCP versie:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
DEVICE="eth0"
IPADDR="MIJN IP THUIS"
NETMASK=""
ONBOOT="no"
BOOTPROTO="dhcp"
IPXNETNUM_802_2=""
IPXPRIMARY_802_2="no"
IPXACTIVE_802_2="no"
IPXNETNUM_802_3=""
IPXPRIMARY_802_3="no"
IPXACTIVE_802_3="no"
IPXNETNUM_ETHERII=""
IPXPRIMARY_ETHERII="no"
IPXACTIVE_ETHERII="no"
IPXNETNUM_SNAP=""
IPXPRIMARY_SNAP="no"
IPXACTIVE_SNAP="no"
De local versie (none) is hetzelfde behalve dat BOOTPROTO="none" is ipv dhcp.

More than meets the eye
There is no I in TEAM... but there is ME
system specs

Pagina: 1