vmware環境 Ubuntu14.04 靜態ip

前言:鑑於沒有足夠服務器進行學習、測試,特從新在windows下搭建Vmware環境。

#1、ubuntu14.04安裝 正常默認安裝。 注意點: 一、新增長用戶、密碼; 二、須要安裝 OpenSSH serverubuntu

#2、設置root用戶密碼windows

一、終端輸入命令:passwd,輸入當前用戶密碼
   二、終端輸入命令:su root,輸入root新密碼

輸入圖片說明

#3、更新源列表 可切換到root用戶服務器

命令:su – root
輸入命令: apt-get update

注意:正常狀況下,在虛擬機vmware安裝好ubuntu後,便可連上網絡,訪問外網。網絡

#4、安裝ssh(若以前無安裝openssh server)ssh

一、輸入命令: apt-get install openssh-server
二、查看是否啓動命令: ps –ef|grep ssh
三、修改配置文件: vi  /etc/ssh/sshd_config
註釋:"PermitRootLogin without-password"加一個"#"號,把它註釋掉.
新增:"PermitRootLogin yes",保存修改。

#5、固定靜態IP地址 ##一、查看本機虛擬網卡網關地址: 打開vmware軟件(windows平臺),獲取網關: 192.168.112.2 輸入圖片說明oop

##二、設置網卡靜態ip地址 編輯文件: vi /etc/network/interfaces學習

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
 auto lo
 iface lo inet loopback

# The primary network interface
#  auto eth0
# iface eth0 inet dhcp
auto eth0
iface eth0 inet static
address 192.168.112.10
netmask 255.255.255.0
gateway 192.168.112.2
broadcast 192.168.0.255
nameserver 192.168.112.2

輸入圖片說明

**注意: a、address 段:192.168.112.XXX b、gateway : 192.168.112.2 (前面獲取) **測試

##三、配置DNS解釋rest

a、編輯文件:/etc/resolvconf/resolv.conf.d/base 
   增長:nameserver 192.168.112.2
b、編輯文件:vm /etc/resolv.conf
增長:nameserver 192.168.112.2

##四、重啓網卡code

a、執行命令: /etc/init.d/networking restart
b、或執行命令:
   關閉網卡 ifdown eth0
   開啓網卡 ifup eth0

備註:建議重啓ubuntu系統

##五、最終網卡配置 輸入圖片說明

#6、SecurtCRT鏈接: ip地址: 192.168.112.10 端口: 22 (原ssh配置未改動)

#7、備註: 本文重點:

一、網關配置
二、DNS解釋配置
三、以上憑記憶記錄,有差錯,請指出。
相關文章
相關標籤/搜索