您的位置:首页 > 理论基础 > 计算机网络

[收集]命令行配置网络

2006-07-18 13:46 239 查看
不知是不是有朋友像我一样从用户权限下runas来得到一个管理员权限的cmd然后对电脑进行配置的修改,对于网络的配置用runas似乎不大好办,其实我们一样可以作到:)

下面看如何来作

C:/>ipconfig /all 麢??R
V傭?篾9纻
Windows IP Configuration 2w?槩划
鰆?yl?
Host Name . . . . . . . . . . . . : ibm-8v8wrwvmdl4 溵髭1
Primary Dns Suffix . . . . . . . : 6絙)|?v?
Node Type . . . . . . . . . . . . : Unknown 2屣/X磠X?
IP Routing Enabled. . . . . . . . : No $>? 姾宙
WINS Proxy Enabled. . . . . . . . : No 氊j?Z |
√俶诈^ ?
Ethernet adapter 本地连接: M訛埙啰
9鴡 _
Connection-specific DNS Suffix . : O询N?4 ?
Description . . . . . . . . . . . : Intel(R) PRO/100 VE Network Connecti ?罯[澝宸?
on 驴函袟︵?
Physical Address. . . . . . . . . : 00-02-8A-21-C8-62 瓅謃鎛C@?
Dhcp Enabled. . . . . . . . . . . : Yes 燪駾抻?獯
Autoconfiguration Enabled . . . . : Yes 3纆/?e?K
Autoconfiguration IP Address. . . : 169.254.163.104 N扆I贄历?
Subnet Mask . . . . . . . . . . . : 255.255.0.0 ?纑?DCn
Default Gateway . . . . . . . . . : b3j媇??
噶)^NJ(
C:/>netsh 憛s払 `誕
netsh>interface W O襴a譔峮
netsh interface>ip ?: 旊偌?
netsh interface ip>add address "本地连接" 172.31.50.205 255.255.255.0 172.31.50.254 1 ?莼卣碜鞚
确定。 痼k逖k7??
{}??t>戍
netsh interface ip>add dns "本地连接" 211.167.254.226 index=1 pi?珒G
确定。 隸??X撞?
帢ⅰ喢H/??
netsh interface ip>exit Cfp嬐<?
N撚P媄褆〨
H pmR豧?
C:/>ipconfig /all Mn洇鳒炔
?蝃?族
Windows IP Configuration 媰P@鯑aA
S勶吊:Z撴=
Host Name . . . . . . . . . . . . : ibm-8v8wrwvmdl4 c8氒???
Primary Dns Suffix . . . . . . . : ;溦[u?O??
Node Type . . . . . . . . . . . . : Unknown ?抱wT?惱d
IP Routing Enabled. . . . . . . . : No X罌<育KK?
WINS Proxy Enabled. . . . . . . . : No Xgy氣
u鵴尡=h
Ethernet adapter 本地连接: c?唌?
?媂濄?
Connection-specific DNS Suffix . : 嬨"0o?
Description . . . . . . . . . . . : Intel(R) PRO/100 VE Network Connecti LK憨餣?lt;
on V鑔*?8
Physical Address. . . . . . . . . : 00-02-8A-21-C8-62 ?>胔 ??
Dhcp Enabled. . . . . . . . . . . : No ?臹牙糭:?
IP Address. . . . . . . . . . . . : 172.31.50.205 Z;@?,
Subnet Mask . . . . . . . . . . . : 255.255.255.0 iP崁3甉
Default Gateway . . . . . . . . . : 172.31.50.254 s儃2??
DNS Servers . . . . . . . . . . . : 211.167.254.226 褨銋q觘

批处理命令行改变IP配置

备份:netsh -c interface dump>aaaa.txt

然后复制修改aaaa.txt为不同的配置

还原不同的配置文件:netsh -f aaaa.txt

命令行下配置Windows XP防火墙

命令:netsh firewall

  参数:

  ? // 显示命令列表

  add // 添加防火墙配置

  delete // 删除防火墙配置

  dump // 显示一个配置脚本

  help // 显示命令列表

  reset // 将防火墙配置重置为默认值。

  set // 设置防火墙配置

  show // 显示防火墙配置

  add allowedprogram // 添加防火墙允许的程序配置。

  add portopening // 添加防火墙端口配置

  delete allowedprogram // 删除防火墙允许的程序配置

  delete portopening // 删除防火墙端口配置

  set allowedprogram // 设置防火墙允许的程序配置

  set icmpsetting // 设置防火墙 ICMP 配置

  set logging // 设置防火墙记录配置

  set multicastbroadcastresponse // 设置防火墙多播/广播响应配置

  set notifications // 设置防火墙通知配置

  set opmode // 设置防火墙操作配置

  set portopening // 设置防火墙端口配置

  set service // 设置防火墙服务配置

  show allowedprogram // 显示防火墙允许的程序配置

  show config // 显示防火墙配置。

  show currentprofile // 显示当前防火墙配置文件

  show icmpsetting // 显示防火墙 ICMP 配置

  show logging // 显示防火墙记录配置

  show multicastbroadcastresponse // 显示防火墙多播/广播响应配置
  show notifications // 显示防火墙操作配置

  show opmode // 显示防火墙端口配置

  show portopening // 显示防火墙端口配置

  show service // 显示防火墙服务配置

  show state // 显示当前防火墙状态  

  例如:

  命令:netsh firewall show allowedprogram //查看防火墙放行的程序

  netsh firewall set portopening TCP 445 ENABLE //打开445端口

  netsh firewall set portopening TCP 3389 ENABLE //不用说了,放行终端啦。。

  netsh firewall delete allowedprogram C:/A.exe //删除放行程序A.exe

  netsh firewall set allowedprogram C:/A.exe A ENABLE //添加程序C盘下的A.exe并放行

  netsh firewall add allowedprogram C:/A.exe A ENABLE //添加程序C盘下的A.exe并放行 

  set allowedprogram和add allowedprogram效果一样都可以添加放行程序,C:/A.exe是程序路径A是在防火墙里显示的程序名字,这个名字可以 随便写,别有用心的家伙可以用个迷惑性的名字。。呵呵。。其他命令自己试试吧。。

  要是终端登陆做了IP限制的可以用netsh firewall set portopening TCP 3389 远程桌面 ENABLE CUSTOM 1.1.1.1<---你的IP,这个命令(中文版XP2)。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: