linux下配置静态路由
Internet------(eth1)router1(eth2)------(eth1)router2(eth0)------(eth0)router3(eth1)------(eth0)pc
上面就是我的网络拓扑结构,其中路由器1是用来连接外部网络的一台linux机器,图中所有路由器都是普通的pc机,这些pc都安装了ubuntu桌面系统,除了最右边的pc,其余的pc都装了3张网卡(其中一张备用)。
由于Debian系的网卡配置跟Redhat系很不一样,Redhat是放在/etc/sysconfig/network-scripts目录下面的一大堆文件里面。而Debian系的网卡配置则是存在/etc/network/interfaces这个文件里面,而且不管你有多少块网卡,系统都把配置统统放在这个文件里。下面就来看一下这个文件的内容。
首先,我们来看router1的配置:
auto lo
iface lo inet loopback
iface lo inet6 loopback
auto eth0
iface eth0 inet static
address 192.168.2.1
network 192.168.2.0
netmask 255.255.255.0
broadcast 192.168.2.255
up route add -net 192.168.3.0 netmask 255.255.255.0 gw 192.168.2.2
down route del -net 192.168.3.0 netmask 255.255.255.0 gw 192.168.2.2
up route add -net 192.168.4.0 netmask 255.255.255.0 gw 192.168.2.2
down route del -net 192.168.4.0 netmask 255.255.255.0 gw 192.168.2.2
iface eth0 inet6 static
address 2000:2::1
netmask 64
up route -A inet6 add 2000:3::/64 gw 2000:2::2
up route -A inet6 add 2000:4::/64 gw 2000:2::2
down route -A inet6 del 2000:3::/64 gw 2000:2::2
down route -A inet6 del 2000:4::/64 gw 2000:2::2
auto eth1
iface eth1 inet dhcp
上面的配置中,
auto说明lo接口跟eth0接口会在系统启动时被自动配置;lo为一个本地回环(loopback)地址,这里分别设置了v4和v6两个loopback;static说明这是一个静态的IP配置;后面配置的作用在于在接口启用的时候,添加两条静态路由,
相关文档:
/*
* linux/fs/fcntl.c
*
* (C) 1991 Linus Torvalds
*/
#include <string.h>
#include <errno.h>
#include <linux/sched.h>
#include <linux/kernel.h>
#include <asm/segment.h>
#include <fcntl.h>
#include <sys/stat. ......
Linux文件查找命令find,xargs详述
一、find 命令格式
1、find命令的一般形式为;
find pathname -options [-print -exec -ok ...]
2、find命令的参数;
pathname: find命令所查找的目录路径。例如用.来表示当前目录,用/来表示系统根目录。
-print: find命令将匹配的文件输出到标准输出。
-exec: find命令对 ......
public class Test {
public static void main(String aa[]) {
if (System.getProperty("os.name").equals("Linux")) {
System.out.println("linux");
} else if (System.getProperty("os.name").equals("Windows XP")) {
System.out.println("win ......
linux下 mysql 的卸载和安装
关键字: linux下 mysql 的卸载和安装
一、前期准备:
1
.由于redhat Enterprise 5 中自带一个mysql的版本,如果在安装linux前未选择mysql的安装此步就可跳过,因为我当时安装了现在将其卸载
,步骤如下:
&nb ......
嵌入式linux基础知识大纲
其实这段时间非常的忙,忙到连做饭吃的时间都没有了。但是今天我特意抽空,来给关注我的朋友们一点点交代。(因为今天发现关注的人还蛮多的,有点受宠若惊啊!哈哈....)如题我暂时只能给大家一些大纲,很详细的学习过程要等大概半个月的时间,我有了空闲时间才能 ......