Linux网络及相关工具命令和IP地址 (学习笔记)

 创建临时ip


          sudo ifconfig eth0:0 192.168.10.10 up    //启动
          sudo ifconfig eth0:0 down               //删除

一个网卡添加多个ip

     sudo ip address add 192.168.1.254/24 dev eth0    //在eth0网卡添加 此地址
       
      sudo ip address del 192.168.1.254/24 dev eth0    //删除eth0网卡中 此地址
     
        ip address show eth0                           //查看eth0网卡信息和ip

安装网络工具

 安装ping:
               apt-get install inetutils-ping
 
 安装ifconfig:
               apt-get install  net-tools
 
 安装ip:        
               apt-get install iproute iproute-doc
                或者apt-get install iproute2 iproute2-doc

网络路由

route                                       //查看路由
route add 172.19.0.0/16 mask 255.255.255.0 10.0.75.2  -p  //添加永久路由

查看端口并关闭

    netstat -ap | grep 8080    /   lsof -i:8888    //查看某个端口

     kill +pid                                      关闭端口

/etc/hosts

192.168.0.1    master      //master名字随意加,是相对于本主机的,不用对应真实Hostname,

切换Python2和Python3,默认使用

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100

sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150 /换为Python3
 
sudo update-alternatives --config python                                     //确认配置

 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值