嵌入式linux开发环境搭建(一)——双网卡的网络设置


一、linux发行版为ubuntu-14.04.4-server-amd64版本

安装ubuntu

二、网络设置

    1、虚拟机添加双网卡

           eth0桥接无线网卡用于Ubuntu上网,eth1桥接有线网卡用于连接开发板。eth0eth1网卡设置如下图所示:


wKioL1dIG3DT0fS0AABt3jPe7CY935.png-wh_50

wKiom1dIGnmheBkiAABx1XIkNRU942.png-wh_50

2、设置网络

先查看网卡:ifconfig | more

如果没有显示eth0、eth1网卡,则用ifconfig eth0 up;ifconfig eth1 up激活网卡eth0、eth1.再次用ifconfig | more查看,此时显示eth0、eth1网卡。

修改配置文件/etc/network/interfaces。

在文件末尾添加eth0、eth1设置

auto eth0
iface eth0 inet static
address 192.168.0.201
gateway 192.168.0.1

netmask 255.255.255.0

network 192.168.0.0

dns-nameservers 61.166.150.123
auto eth1
iface eth1 inet static
address 192.168.6.201

netmask 255.255.255.0

network 192.168.6.0
dns-nameservers 61.166.150.123

 

修改DNS配置文件/etc/resolv.conf

nameserver 61.166.150.123

 

关闭防火墙

ufw disable

 

重启网卡

/etc/init.d/networking restart


安装openssh

apt-get install openssh-server

配置文件:/etc/ssh/sshd_config


此时就可以使用secureCRT等连接linux了。


如果此时仍然连不上外网,考虑重启系统reboot



注意:网关只能设置一个,无线网卡连接互联网,需要设置网关,有线网卡连接开发板不能设置网关