Archive for June, 2018

42 packages can be updated.
18 updates are security updates.

sudo apt-get update && sudo apt-get dist-upgrade

路由冲突无法外部无法ping通ip

root@ubuntu:/home/administrator# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         185.221.134.249 0.0.0.0         UG    0      0        0 eno1
156.233.42.0    156.233.42.1    255.255.255.0   UG    0      0        0 eno2
156.233.42.0    *               255.255.255.0   U     0      0        0 eno2
156.233.42.0    *               255.255.255.0   U     0      0        0 eno1
localnet        *               255.255.255.248 U     0      0        0 eno1
root@ubuntu:/home/administrator# route del -net 156.233.42.0 netmask 255.255.255.0
root@ubuntu:/home/administrator# route del -net 156.233.42.0 netmask 255.255.255.0
root@ubuntu:/home/administrator# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         185.221.134.249 0.0.0.0         UG    0      0        0 eno1
156.233.42.0    *               255.255.255.0   U     0      0        0 eno1
localnet        *               255.255.255.248 U     0      0        0 eno1
作者:AngryFox 分类: Uncategorized June 26th, 2018 暂无评论

一,从官网下载go源码

对于64位的Linux
$ wget https://storage.googleapis.com/golang/go1.9.1.linux-amd64.tar.gz
对于32位的Linux

$ wget https://storage.googleapis.com/golang/go1.9.1.linux-386.tar.gz

具体查看Go 的官网:https://golang.org/dl/

在/usr/local下安装程序

$ sudo tar -xzf go1.9.1.linux-amd64.tar.gz -C /usr/local

配置全局变量

$ sudo gedit ~/.bashrc
在文件添加以下两行信息

export GOPATH=/usr/local/go
export PATH=$GOPATH/bin:$PATH

使修改生效

# source ~/.bashrc
export GOROOT=/usr/local/go
export GOPATH=$PATH:$GOROOT/bin

验证

go version
go version go1.9.1 linux/amd64

作者:AngryFox 分类: Uncategorized June 5th, 2018 暂无评论

批量生成
# !/bin/bash
for ((i=3;i<=255;i=i+1))
do
echo "auto eno2:$i">>/root/x.text
echo “iface eno2:$i inet static”>>/root/x.text
echo “address 156.233.42.$i”>>/root/x.text
echo “netmask 255.255.255.0″>>/root/x.text
echo ” “>>/root/x.text
done
# end

第二种方法:修改网卡配置文件

在ubuntu下,网卡的配置文件是/etc/network/interfaces,所以我们修改它:

sudo gedit /etc/network/interfaces

照eth0添加eth0:0

auto eth0
iface eth0 inet static
name Ethernet Lan card
address 192.168.1.2
netmask 255.255.255.0
network 192.168.1.1
broadcast 192.168.1.255
gateway 192.168.1.254

auto eth0:0
iface eth0:0 inet static
name Ethernet Lan card
address 192.168.1.3
netmask 255.255.255.0
network 192.168.1.1
broadcast 192.168.1.255
gateway 192.168.1.254

然后重启服务

sudo /etc/init.d/networking restart

测试新的ip地址

ping 192.168.1.2
ping 192.168.1.3