zoukankan      html  css  js  c++  java
  • ubuntu设置固定ip

    设定IP

    $sudo gedit /etc/network/interfaces

    auto lo

    iface lo inet loopback           

    auto eth0

    iface eth0 inet static

    address 192.168.0.111

    netmask 255.255.255.0

    gateway 192.168.0.1

    保存,并关闭gedit。 这样,IP并没有立即生效。需要执行

    $sudo /etc/init.d/networking restart
    这时候就能ping到局域网中的电脑了。但是上不了Internet,是因为没有设置DNS的原因。DNS信息保存在/etc/resolv.conf中,一旦更改,立即生效。

    2)配置DNS: sudo gedit /etc/resolv.conf

    nameserver 202.107.117.11

    保存并关闭,现在就可以上网了。
    附网卡设置相关命令:
    查看网卡信息: ifconfig
    设定一个网卡IP:ifconfig eth1 192.168.1.10 netmask 255.255.255.0
    重启网卡使设定生效:sudo /etc/init.d/networking restart
    更改MAC地址:ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
    查看路由相关信息:route -n

  • 相关阅读:
    python 冒泡排序
    python 文件操作
    20180401 lambda表达式
    python 全局变量 局部变量
    python 参数
    window.open
    正则表达式
    应用环境操作
    python 十大经典排序算法
    W3C------JS
  • 原文地址:https://www.cnblogs.com/0822vaj/p/3809180.html
Copyright © 2011-2022 走看看