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配置;后面配置的作用在于在接口启用的时候,添加两条静态路由,
相关文档:
介绍SSH
什么是SSH?
传统的网络服务程序,如:ftp、pop和telnet在本质上都是不安全的,因为它们在网络上用明文传送口令和数据,别有用心的人非常容易就可以截获这些口令和数据。而且,这些服务程序的安全验证方式也是有其弱点的,就是很容易受到“中间人”(man-in-the-middle)这种方式的攻击。所谓“中 ......
文档创建时间:2010-02-14
1 // P120: 3.编程题 (3)
2
3 // The begining of C program: test04-03.c.
4
  ......
GDB是GNU开源组织发布的一个强大的UNIX下的程序调试工具。或许,各位比较喜欢那种图形
界面方式的,像VC、BCB等IDE的调试,但如果你是在UNIX平台下做软件,你会发现GDB这个
调试工具有比VC、BCB的图形化调试器更强大的功能。所谓“寸有所长,尺有所短”就是这
个道理。
一 ......
/*
* linux/fs/bitmap.c
*
* (C) 1991 Linus Torvalds
*/
/* bitmap.c contains the code that handles the inode and block bitmaps */
#include <string.h>
#include <linux/sched.h>
#include <linux/kernel.h> // 一些内核常用函数的原形定义
......
/*
* linux/fs/inode.c
*
* (C) 1991 Linus Torvalds
*/
#include <string.h>
#include <sys/stat.h> // 文件状态头文件
#include <linux/sched.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <asm/system.h>
......