远程调试没配网络的电脑

使用方法<p style="margin-right: 0cm; margin-left: 0cm;font-size:14px; font-family: 宋体; color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><span> </span>1.将正常机与问题机网线直连</p><p style="margin-right: 0cm; margin-left: 0cm;font-size:14px; font-family: 宋体; color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;">  2.将附件考入u盘,插入正常机,root运行脚本。它会报问题机的ip和通断情况。</p><p style="margin-right: 0cm; margin-left: 0cm;font-size:14px; font-family: 宋体; color: rgb(0, 0, 0); font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px;">  3.若通,ssh即可</p>

#!/bin/bash

###先确保在网卡服务已经开启
#安装dhcp服务
sudo dpkg -i isc-dhcp-server*.deb
#配置DHCP网卡
sed  -i 's/INTERFACES=""/INTERFACES="eth0"/g' /etc/default/isc-dhcp-server
#改配置文件
(
cat <<EOF
ddns-update-style none;
option domain-name "tagpt.mtn";
default-lease-time 14400;
#最小租约14400秒=4小时
max-lease-time 36000;
#最大租约36000秒=10小时
subnet 192.168.7.0 netmask 255.255.255.0 {
#IP地址起止范围
range 192.168.7.190 192.168.7.199;
option subnet-mask 255.255.255.0;
#子网掩码 255.255.255.0
option routers 192.168.7.254;
#默认网关 192.168.7.254
option broadcast-address 192.168.7.255;
#广播地址 192.168.7.255                                                     
}
EOF
) >/etc/dhcp/dhcpd.conf
#重启服务
sudo service isc-dhcp-server restart


#现场使用
sudo  ifconfig eth0 192.168.7.110 netmask 255.255.255.0
sudo route add default gw 192.168.7.254

if [ ! -n "`ping 192.168.7.190 -i 0.2 -c 10 | grep error`" ]; then
	echo 
	echo 通 192.168.7.190
	echo 
else
	echo 不通 192.168.7.190 
fi 

附件:1、本脚本工具

            2、dhcpsever软件,可根据自己的机器下载,以ubuntu为例http://packages.ubuntu.com/xenial/isc-dhcp-server

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值