window用ssh連線本機虛擬機器中的ubuntu
主機和虛擬機器間通訊,需將2臺機器的IP地址設為同一網段。
1、設定虛擬機器: 虛擬機器–> 設定–> Hardware –> Network Adapter,在網路連線處設定為 “橋接:直接連線到物理網路”,“NAT:使用已共享的主機IP地址”處打勾。
其實在第一步中,哪一步中設為橋接模式,並勾選下面那個複選框,就是同一個網段
採用橋接設定才可以PING 通閘道器
最好設定個靜態IP:
sudo vi /etc/network/interfaces,將原有動態IP遮蔽掉
並用下面的行來替換有關eth0的行:在# The primary network interface之後,或在末尾加上
auto eth0
iface eth0 inet static
address 192.168.3.90
gateway 192.168.3.1
netmask 255.255.255.0
network 192.168.3.0
broadcast 192.168.3.255
將上面的ip地址等資訊換成你自己就可以了.用下面的命令使網路設定生效:
sudo /etc/init.d/networking restart
3、互ping下,判斷windows與linux是否互相ping通。
i、C:\Users\jiqinlin>ping 192.168.11.88 #192.168.11.88虛擬機器下ubuntu的ip
正在 Ping 192.168.11.88 具有 32 位元組的資料:
來自 192.168.11.88 的回覆: 位元組=32 時間<1ms TTL=64
來自 192.168.11.88 的回覆: 位元組=32 時間<1ms TTL=64
來自 192.168.11.88 的回覆: 位元組=32 時間<1ms TTL=64
來自 192.168.11.88 的回覆: 位元組=32 時間<1ms TTL=64
192.168.11.88 的 Ping 統計資訊:
資料包: 已傳送 = 4,已接收 = 4,丟失 = 0 (0% 丟失),
往返行程的估計時間(以毫秒為單位):
最短 = 0ms,最長 = 0ms,平均 = 0ms
ii、[email protected]:~# ping 192.168.11.74 #192.168.11.74 windows下ip
PING 192.168.11.74 (192.168.11.74) 56(84) bytes of data.
64 bytes from 192.168.11.74: icmp_req=1 ttl=64 time=0.242 ms
64 bytes from 192.168.11.74: icmp_req=2 ttl=64 time=0.268 ms
64 bytes from 192.168.11.74: icmp_req=3 ttl=64 time=0.251 ms
出現類似資訊表示windows與linux已互通。
4、連線ssh,在連線前記得在window下安裝SSH Secure Shell Client客戶端
操作步驟如下:
在win7下通過ssh連線虛擬機器的ubuntu,連線失敗,提示資訊見下圖:
然後我在ubuntu終端下輸入:ssh localhost,見下圖:
ssh : connect to host localhost port 22: Connection refused,原來沒有裝sshd,也就是openssh-server。
輸入命令: sudo apt-get install openssh-server
也可能會出現:Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
再:apt-get update
然後輸入命令:ssh localhost,見下圖
此時可以通過ssh工具連虛擬機器的ubuntu系統了。
ubuntu apt-get update 失敗解決。
當執行apt-get update後出現如下錯誤時:
E: Some index files failed to download, they have been ignored, or old ones used instead.
可以將目錄下/var/lib/apt/lists/partial/所有的檔案清掉,再次執行apt-get update即可!自帶源在大陸不好。
出現以下錯誤:
[plain] view plaincopyprint?- /etc/apt$ sudo apt-get update
- Err http://security.ubuntu.com precise-security InRelease
- Err http://security.ubuntu.com precise-security Release.gpg
- Temporary failure resolving 'security.ubuntu.com'
- Err http://cn.archive.ubuntu.com precise InRelease
- Err http://cn.archive.ubuntu.com precise-updates InRelease
- Err http://cn.archive.ubuntu.com precise-backports InRelease
- Err http://cn.archive.ubuntu.com precise Release.gpg
- Temporary failure resolving 'cn.archive.ubuntu.com'
- Err http://cn.archive.ubuntu.com precise-updates Release.gpg
- Temporary failure resolving 'cn.archive.ubuntu.com'
- Err http://cn.archive.ubuntu.com precise-backports Release.gpg
- Temporary failure resolving 'cn.archive.ubuntu.com'
- Reading package lists... Done
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise/InRelease
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-updates/InRelease
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-backports/InRelease
- W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/InRelease
- W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/Release.gpg Temporary failure resolving 'security.ubuntu.com'
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise/Release.gpg Temporary failure resolving 'cn.archive.ubuntu.com'
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-updates/Release.gpg Temporary failure resolving 'cn.archive.ubuntu.com'
- W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-backports/Release.gpg Temporary failure resolving 'cn.archive.ubuntu.com'
- W: Some index files failed to download. They have been ignored, or old ones used instead.
- [email protected]:/etc/apt$ cd ../network
/etc/apt$ sudo apt-get update
Err http://security.ubuntu.com precise-security InRelease
Err http://security.ubuntu.com precise-security Release.gpg
Temporary failure resolving 'security.ubuntu.com'
Err http://cn.archive.ubuntu.com precise InRelease
Err http://cn.archive.ubuntu.com precise-updates InRelease
Err http://cn.archive.ubuntu.com precise-backports InRelease
Err http://cn.archive.ubuntu.com precise Release.gpg
Temporary failure resolving 'cn.archive.ubuntu.com'
Err http://cn.archive.ubuntu.com precise-updates Release.gpg
Temporary failure resolving 'cn.archive.ubuntu.com'
Err http://cn.archive.ubuntu.com precise-backports Release.gpg
Temporary failure resolving 'cn.archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise/InRelease
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-updates/InRelease
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-backports/InRelease
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/InRelease
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/precise-security/Release.gpg Temporary failure resolving 'security.ubuntu.com'
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise/Release.gpg Temporary failure resolving 'cn.archive.ubuntu.com'
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-updates/Release.gpg Temporary failure resolving 'cn.archive.ubuntu.com'
W: Failed to fetch http://cn.archive.ubuntu.com/ubuntu/dists/precise-backports/Release.gpg Temporary failure resolving 'cn.archive.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
[email protected]:/etc/apt$ cd ../network
阿里源:
[plain] view plaincopyprint?- deb http://mirrors.aliyun.com/ubuntu/ raring main restricted universe multiverse
- deb http://mirrors.aliyun.com/ubuntu/ raring-security main restricted universe multiverse
- deb http://mirrors.aliyun.com/ubuntu/ raring-updates main restricted universe multiverse
- deb http://mirrors.aliyun.com/ubuntu/ raring-proposed main restricted universe multiverse
- deb http://mirrors.aliyun.com/ubuntu/ raring-backports main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ raring main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ raring-security main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ raring-updates main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ raring-proposed main restricted universe multiverse
- deb-src http://mirrors.aliyun.com/ubuntu/ raring-backports main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ raring main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ raring-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ raring-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ raring-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ raring-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ raring main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ raring-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ raring-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ raring-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ raring-backports main restricted universe multiverse
修改ip:
[plain] view plaincopyprint?- # 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 interfacea
- auto eth0
- iface eth0 inet static
- address 192.168.2.170
- netmask 255.255.255.0
- broadcast 192.168.2.255
- gateway 192.168.2.1
- dns-nameservers 192.168.2.1
# 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 interfacea
auto eth0
iface eth0 inet static
address 192.168.2.170
netmask 255.255.255.0
broadcast 192.168.2.255
gateway 192.168.2.1
dns-nameservers 192.168.2.1
修改dns:
1,重啟生效:
sudo vi /etc/resolvconf/resolv.conf.d/base(這個檔案預設是空的)
在裡面插入:
nameserver 8.8.8.8
nameserver 8.8.4.4
如果有多個DNS就一行一個
修改好儲存,然後執行
sudo resolvconf -u
再看/etc/resolv.conf,最下面就多了2行:
cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 8.8.8.8
nameserver 8.8.4.4
可以看到我們的設定已經加上了,然後再ping一個域名,當時就可以解析了,無需重啟。
2,重啟失效:
配置檔案地址 /etc/resolv.conf
使用編輯器開啟
改為如下內容:
search localdomain
nameserver 202.96.128.86 希望修改成的DNS
nameserver 202.96.128.166 備用DNS
重啟網路:sudo /etc/init.d/networking restart。即可
在目錄:/var/lib/apt/lists/partial 輸入:
相關推薦
window用ssh連線本機虛擬機器中的ubuntu
主機和虛擬機器間通訊,需將2臺機器的IP地址設為同一網段。 1、設定虛擬機器: 虛擬機器–> 設定–> Hardware –> Network Adapter,在網路連線處設定為 “橋接:直接連線到物理網路”,“NAT:使用已共享的主機IP地址”處打勾。 其實在第一步中,哪一步中設為橋
SecureCRT連線本機虛擬機器,區域網虛擬機器
寫程式碼時,我喜歡在linux寫,編譯,執行,但是自己的電腦配置有點低,寫一會,風扇呼呼的轉,於是想何不遠端連線教室虛擬機器,在那上面寫呢? 系統工具:筆記本win7,教室電腦winXP,linux虛擬系統都是centos 連線工具:secureCRT 需要了解的知識:Use bridged networki
如何從本機之外的其他電腦上訪問本機虛擬機器中的django程式
1,將VM虛擬機器設定為橋連線模式,橋連線下的選項(複製物理網路連線狀態(P))如果自己使用的是桌上型電腦機就不必要選。此項的意思就是:假如你的虛擬機器安裝在筆記本上,在你切換有線網路和無線網路時,IP地址就可能會發生變化。選擇了此項之後,IP地址就不會發生變化。 2.在虛
用putty連線本機和虛擬機器
本文介紹在本機用SSH客戶端軟體工具putty連線虛擬機器上的SSH伺服器,本機裝的是win7作業系統,虛擬機器裝的是win10作業系統,並比較FTP和SSH連線的異同和特點。 1. 在本機安裝putty 之所以選擇putty這款軟體,主要是因為它有如下優勢
windows7連結本機虛擬機器redis連結不上的解決方法
首先宣告:本博文不是為了講解怎樣在centosX下安裝redis,centos安裝redis的教程百度上很多資源的,安裝也比較簡單,設定開機啟動,以及埠號,密碼,這些都在redis.conf裡面配置就好了,經過測試,在虛擬機器下可以正常啟動redis,但是在Wi
修改虛擬機器中ubuntu不能使用ssh -X遠端登入問題
gedit /etc/ssh/sshd_config,將PermitRootLogin後面的訪問圈內先設定為prohibit-password 然後source /etc/ssh/sshd_config
linux 11、XShell連線虛擬機器中Ubuntu出現連線失敗的解決辦法
首先本人的環境中已經安裝了連線所需要安全套接字服務,即SSH服務 sudo apt-get install openssh-server 執行該命令後 ps -e | grep ssh 發現所需要的ssh相關服務都開啟了,但是通過xShell連線Ubu
虛擬機器中ubuntu root密碼和使用者密碼都忘記的解決辦法
必須先修改root密碼,需進入GRUB修改kernel映象啟動引數。 實測有效!! 1、重啟,按住shift鍵,出現如下介面,選中如下選項 2、按回車鍵進入如下介面,然後選中有recovery mode的選項 3、按e進入如下介面,找到圖中紅色框的recovery nom
虛擬機器中Ubuntu連不上網問題已解決
方法一:檢查虛擬機器是否已經連線上了。如果沒有,點選連線。(如下圖示) 方法二:個人虛擬機器上無法成功聯網,是由於電腦管家的限制,導致無法啟用虛擬機器的連線。 依次點選,此電腦->右鍵-管理->服務和應用程式->服務(如圖示) &
虛擬機器中Ubuntu取得root許可權
VMware,Ubuntu系統 預設安裝之後,無法進入root身份,怎麼輸密碼都不對 解決辦法就是: 1.執行“sudo passwd -u root”,然後輸入當前賬戶的密碼: 2.執行“sudo passwd root”,然後輸入兩次欲設定的root密碼: 此時,新的root密碼就已經
虛擬機器中ubuntu下make menuconfig命令缺少ncurses解決方法
在臺式機上按著教程弄編譯核心什麼的,發現同樣是RHEL5,我的make menuconfig就缺失ncurses。然後我裝的RHEL5還連不上網了,那怎麼辦,沒法傳東西,vmtools還弄不上,又不像win7預設就vmtools,然後折騰著ubuntu,也有相同問題,好在
虛擬機器中ubuntu不能聯網問題的解決——NAT方式
ubuntu版本:ubuntu-16.04-desktop-amd64.iso 設定虛擬機器不能聯網是很痛苦的,這裡我就ubuntu的NAT上網問題就個人經驗講一下,其他的橋連線等沒有使用就沒有經驗了。 1.檢視/設定下NAT的網路 開啟VMware Worksta
vmware虛擬機器中ubuntu 16.04 caffe 安裝
此次安裝的環境在標題裡講過了,下面說說安裝步驟和踩過的一些坑。。。一.安裝caffe依賴項 sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhd
虛擬機器中ubuntu使用光碟源更新
大多數linux開發版中其實自帶了很多軟體,只不過有些軟體在系統安裝的時候預設不安裝,如果在不能聯網的情況下想安裝某些軟體,那麼安裝的映象是不二的選擇,本文將簡單介紹一下。 環境: Oracle VirtualBox ubuntu14.10 伺服
解決虛擬機器中Ubuntu中的無法上網的問題
我們在裝好虛擬機器中常會發現無法ping通網路的情況。那麼下面我們需要一步一步排查情況(註明我使用的是ubuntu,redhat系列的目錄名會有不同) 需要了解的是,ifconfig 命令有時會用來臨時配置ip地址,因為是臨時性的,等到下次登陸就恢復,所以我們使用配置
忘記虛擬機器中ubuntu登入使用者名稱和密碼
環境:虛擬機器:virtualbox系統:ubuntu16.04問題:忘記登入使用者名稱和密碼主要難點:如何在沒有使用者名稱和密碼的情況下,進入系統,並且更改密碼思路1:進入字元介面,登入root使用者,更改使用者名稱和密碼。 存在問題:從鍵盤輸入ct
虛擬機器中ubuntu設定靜態IP的方法
一般來說,常用的第一塊乙太網卡在Linux的名稱為eth0,以此為例來說明—— 1 臨時性修改MAC並設定靜態IP(重啟networking後復原) 1.1 設定MAC地址 #關閉網絡卡裝置,否則會報告系統忙,無法更改: sudo ifconfig eth0 down #修改MAC地址,填寫修改後的MA
解決虛擬機器中Ubuntu的左邊框和上邊框消失問題
不知哪裡衝突了,今天虛擬機器中的Ubuntu14的上邊框和左邊框消失 解決方法 1,桌面右擊,開啟終端,輸入ccsm,如果找不到ccsm就手動apt-get install安裝 2.找到Ubunt
如何為虛擬機器中的Ubuntu17安裝SSH服務以及與XShell建立連線
本人在Ubuntu中安裝SSH時,在未獲取root許可權的情況下是不能安裝SSH,因此,本人通過以下步驟獲取得到root許可權,獲取步驟如下: 1.首先輸入: sudo passwd root 2.Enter new UNIX password:(在這裡輸入密碼) 3.retype
配置虛擬機器系統Ubuntu 18.4連線到宿主機上網
先檢視虛擬機器的網路介面卡:點選虛擬機器左上角的編輯,裡面有個網路介面卡 然後再進入編輯虛擬機器設定,看過上一篇安裝Ubuntu的朋友便知道我們當初安裝時點選的是NAT設定 這裡我們要改成自定義:特定虛擬網路,選擇VM8,原因可以看上面網路介面卡的圖 設定完