在 Ubuntu 8.0.4下设置静态IP和虚拟机

    技术2025-10-05  5

    1-手动修改网络配置文件:sudo gedit /etc/network/interfaces加入(或者修改)下列行:auto lo eth0iface lo inet loopbackiface eth0 inet staticaddress 192.168.1.6netmask 255.255.255.0gateway 192.168.1.1auto eth0:0iface eth0:0 inet staticaddress 192.168.1.10netmask 255.255.255.0gateway 192.168.1.1auto eth0:1iface eth0:1 inet staticaddress 192.168.1.12netmask 255.255.255.0gateway 192.168.1.1保存修改。2.2-手动修改DNS配置文件:sudo nano /etc/resolv.conf加入(或者修改)下列行:# Generated by NetworkManagernameserver 192.168.1.1nameserver 202.106.46.151保存修改。2.3- 手动重启网络服务:sudo /etc/init.d/networking restart返回结果如下:*Reconfiguring network interfaces… [OK]现在,你可以在终端里输入ifconfig命令来查看你修改的结果。如果不对,你还需要重启下。设置apache的虚拟机1 在workspace里添加doucument root2 在/etc/apache2/sites-available 创建虚拟机配置文件 192.168.1.10, 内容如下:

    <VirtualHost 192.168.1.10:80> ServerAdmin webmaster@localhost DocumentRoot /home/edwin/Zend/workspaces/DefaultWorkspace/ZfProjects-Main/Public Options FollowSymLinks AllowOverride None Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch Order allow,deny Allow from all ErrorLog /var/log/apache2/192.168.1.10.error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn CustomLog /var/log/apache2/192.168.1.10.access.log combined Alias /doc/ "/usr/share/doc/" Options Indexes MultiViews FollowSymLinks AllowOverride None Order deny,allow Deny from all Allow from 127.0.0.0/255.0.0.0 ::1/128 <VirtualHost *:80> 3 重启apache 服务 sudo a2ensite 192.168.1.10sudo /etc/init.d/apache2 restart

    最新回复(0)