NetSh: Configurant Win 2k/XP des de la consola
Reading time: 7 – 12 minutes
Doncs avui buscant i rebuscant cosetes com sempre, m’he trobat amb un cmd q
mai havia vist al pindows, de fet, em sembla q no és massa vell. El
netsh que permet configurar moltíssimes coses des de la consola, de fet,
la seva potència és molt major q la q comentaré…
però a mi el q més m’ha agradat és poder-me fer fitxers
de configuració diferents amb les configuracions de xarxa de les
diferents empreses on vaig, per exemple:
pushd interface
reset all
popd
pushd interface ip
set address name=”Local Area Connection 2″ source=static addr=192.168.1.111
mask
=255.255.255.0
set address name=”Local Area Connection 2″ gateway=192.168.1.254
gwmetric=0
set dns name=”Local Area Connection 2″ source=static addr=192.168.1.1
register=P
RIMARY
add dns name=”Local Area Connection 2″ addr=194.179.1.101
register=PRIMARY
set wins name=”Local Area Connection 2″ source=static addr=none
popd
això seria un fitxer de configuració q podria cridar així:
netsh -c fitxer_configuracio.txt i automaticament configuraria la meva
interficie de xarxa.
Us recomano q feu un: netsh i que després entreu un help a la seva
consola d veritat q dona molt d si el q podem veure i el q podem alterar des
d’aquest programet.
A més si ja tenim la interificie configurada i volem extreure el fitxer
de configuracio fent:
netsh interface ip dump
podem obtenir el fitxer d configuració. Es molt guay!!! sembla mentida
la d cosetes q fa. Per capturar el fitxer com tots ja sabem, podriem fer:
netsh interface ip dump > homeconfig.txt
i si el vull carregar:
netsh -f homeconfig.txt
però podem fer copies de configuracions molt més globals, fins hi
tot d tot el sistema:
netsh dump
i obtindriem:
pushd interface
reset all
popd
pushd interface ip
set address name=”Local Area Connection 2″ source=static addr=192.168.1.111
mask=255.255.255.0
set address name=”Local Area Connection 2″ gateway=192.168.1.254
gwmetric=0
set dns name=”Local Area Connection 2″ source=static addr=192.168.1.1
register=PRIMARY
add dns name=”Local Area Connection 2″ addr=194.179.1.101
register=PRIMARY
set wins name=”Local Area Connection 2″ source=static addr=none
popd
pushd ras
set authmode mode = standard
delete authtype type = PAP
delete authtype type = SPAP
delete authtype type = MD5CHAP
delete authtype type = MSCHAP
delete authtype type = MSCHAPv2
delete authtype type = EAP
add authtype type = MSCHAP
delete link type = SWC
delete link type = LCP
add link type = SWC
add link type = LCP
delete multilink type = MULTI
delete multilink type = BACP
add multilink type = MULTI
add multilink type = BACP
set user name = abl dialin = policy cbpolicy = none
set user name = aca dialin = policy cbpolicy = none
set user name = Administrador dialin = policy cbpolicy = none
set user name = Administrator dialin = policy cbpolicy = none
set user name = agc dialin = policy cbpolicy = none
set user name = alj dialin = policy cbpolicy = none
set user name = all dialin = policy cbpolicy = none
set user name = amm dialin = policy cbpolicy = none
set user name = apc dialin = policy cbpolicy = none
set user name = cgg dialin = policy cbpolicy = none
set user name = cgl dialin = policy cbpolicy = none
set user name = cmc dialin = policy cbpolicy = none
set user name = dga dialin = policy cbpolicy = none
set user name = ebf dialin = policy cbpolicy = none
set user name = edo dialin = policy cbpolicy = none
set user name = elb dialin = policy cbpolicy = none
set user name = enb dialin = policy cbpolicy = none
set user name = erc dialin = policy cbpolicy = none
set user name = fbb dialin = policy cbpolicy = none
set user name = fvb dialin = policy cbpolicy = none
set user name = gtc dialin = policy cbpolicy = none
set user name = Guest dialin = policy cbpolicy = none
set user name = HelpAssistant dialin = policy cbpolicy = none
set user name = Invitado dialin = policy cbpolicy = none
set user name = jbf dialin = policy cbpolicy = none
set user name = jch dialin = policy cbpolicy = none
set user name = jga dialin = policy cbpolicy = none
set user name = jgg dialin = policy cbpolicy = none
set user name = jmp dialin = policy cbpolicy = none
set user name = jsm dialin = policy cbpolicy = none
set user name = jto dialin = policy cbpolicy = none
set user name = lcl dialin = policy cbpolicy = none
set user name = lma dialin = policy cbpolicy = none
set user name = mbb dialin = policy cbpolicy = none
set user name = mcr dialin = policy cbpolicy = none
set user name = mgg dialin = policy cbpolicy = none
set user name = mjg dialin = policy cbpolicy = none
set user name = mlm dialin = policy cbpolicy = none
set user name = mma dialin = policy cbpolicy = none
set user name = mmo dialin = policy cbpolicy = none
set user name = mpv dialin = policy cbpolicy = none
set user name = mra dialin = policy cbpolicy = none
set user name = msg dialin = policy cbpolicy = none
set user name = mtp dialin = policy cbpolicy = none
set user name = nag dialin = policy cbpolicy = none
set user name = oes dialin = policy cbpolicy = none
set user name = Oriol dialin = policy cbpolicy = none
set user name = rcb dialin = policy cbpolicy = none
set user name = rcf dialin = policy cbpolicy = none
set user name = reg dialin = policy cbpolicy = none
set user name = rmb dialin = policy cbpolicy = none
set user name = rmh dialin = policy cbpolicy = none
set user name = rmm dialin = policy cbpolicy = none
set user name = RNB dialin = policy cbpolicy = none
set user name = ros dialin = policy cbpolicy = none
set user name = rrc dialin = policy cbpolicy = none
set user name = rrg dialin = policy cbpolicy = none
set user name = sgm dialin = policy cbpolicy = none
set user name = soj dialin = policy cbpolicy = none
set user name = spr dialin = policy cbpolicy = none
set user name = SQLAgentCmdExec dialin = policy cbpolicy = none
set user name = ssm dialin = policy cbpolicy = none
set user name = SUPPORT_388945a0 dialin = policy cbpolicy = none
set user name = vpc dialin = policy cbpolicy = none
set user name = xse dialin = policy cbpolicy = none
set user name = xtc dialin = policy cbpolicy = none
set user name = xvd dialin = policy cbpolicy = none
set user name = ypz dialin = policy cbpolicy = none
set user name = yrg dialin = policy cbpolicy = none
set tracing component = * state = disabled
popd
pushd ras appletalk
set negotiation mode = allow
set access mode = all
popd
pushd ras ip
delete pool
set negotiation mode = allow
set access mode = all
set addrreq mode = deny
set broadcastnameresolution mode = disabled
set addrassign method = auto
popd
pushd ras ipx
set negotiation mode = allow
set access mode = all
set nodereq mode = allow
set netassign method = autosame
popd
pushd ras netbeui
set negotiation mode = allow
set access mode = all
popd
pushd ras aaaa
set authentication provider = windows
set accounting provider = windows
delete authserver name = *
delete acctserver name = *
popd
pushd routing
reset
popd
pushd routing ipx
popd
pushd routing ipx rip
popd
pushd routing ipx sap
popd
pushd routing ipx netbios
popd
pushd routing ip
reset
set loglevel error
add preferenceforprotocol proto=LOCAL preflevel=1
add preferenceforprotocol proto=NetMgmt preflevel=10
add preferenceforprotocol proto=STATIC preflevel=3
add preferenceforprotocol proto=NONDOD preflevel=5
add preferenceforprotocol proto=AUTOSTATIC preflevel=7
add preferenceforprotocol proto=OSPF preflevel=110
add preferenceforprotocol proto=RIP preflevel=120
add interface name=”Internal” state=enable
set filter name=”Internal” fragcheck=disable
add interface name=”Loopback” state=enable
set filter name=”Loopback” fragcheck=disable
popd
pushd routing ip dnsproxy
uninstall
popd
pushd routing ip igmp
uninstall
popd
pushd routing ip nat
uninstall
popd
pushd routing ip ospf
uninstall
popd
pushd routing ip relay
uninstall
popd
pushd routing ip rip
uninstall
popd
pushd routing ip routerdiscovery
uninstall
add interface name=”Internal” disc=disable minint=7 maxint=10 life=30
level=0
add interface name=”Loopback” disc=disable minint=7 maxint=10 life=30
level=0
popd
pushd routing ip autodhcp
uninstall
popd
Doncs bé això és una mica tot el q fa el netsh,
però repeteixo q no ús perdeu les opcions q té, feu un
help!!!