Çë½Ì¹ØÓÚLinuxµÄiptablesµÄnat
192.168.0.201ÊÇLinux
192.168.0.35ÊÇÁíÍâһ̨װÓÐWEBµÄ·þÎñÆ÷£¬
ÎÒÏë·ÃÎÊ192.168.0.201µÄʱºò
ÈÃËûnatµ½192.168.0.35µÄ80ÉÏ¡£
ÒÔÏÂÊÇÎÒÉèÖõģ¬µ«ÊDz»ÐС£Ó¦¸ÃÔõôÉèÖÃѽ£¿
root@ubuntu:/home/# iptables -t nat -F
root@ubuntu:/home/# iptables -t nat -X
root@ubuntu:/home/# iptables -t nat -A PREROUTING -i eth0 -d 192.168.0.201 -p tcp --dport 80 -j DNAT --to 192.168.0.35:80
root@ubuntu:/home/# iptables -t nat -A POSTROUTING -o eth0 -s 192.168.0.35 -p tcp --sport 80 -j SNAT --to 192.168.0.201:80
ÓÃtcpdump×¥°ü¿´¿´¾ßÌåµÄ·¢°ü.
ÁíÍâ, ÐèÒª¿ªÆôipv4_forward
ÒѾ net.ipv4.ip_forward = 1 ¹ýÁË£¬¿É»¹ÊDz»ÐÐ
Ä㻹Ҫȷ±£´Óserver·µ»ØµÄÊý¾Ý°üÒ»¶¨»¹»á¾¹ýlinuxµÄ»úÆ÷¡£
[
UP
ÎÒ·¢ÏÖ¿Í»§»úÎÞ·¨Á¬½Óµ½linuxµÄ»úÆ÷
ËùÒÔ¼ÓÁËÕâÁ½Ìõ
iptables -t filter -A INPUT -s 192.168.0.200/24 -j ACCEPT
iptables -t filter -A OUTPUT -d 192.168.0.200/24 -j ACCEPT
µ«ÊÇ»¹ÊÇÁ¬²»ÉÏLinux
192.168.0.35ÊÇweb·þÎñÆ÷
192.168.0.201ÊÇLinux»ú
192.168.0.200ÊÇ¿Í»§»ú
ÎÒÏëÓÃ200ͨ¹ý201µÄnatÁ¬½Ó35µÄ80ÉÏ
Ïà¹ØÎÊ´ð£º
int _send()
{
int fd,size;
char fname[1024],buffer[4096];
/*ÊäÈëÒª´«ÊäµÄÎļþ*/
printf("ÇëÊäÈëÄúÒª´«ÊäµÄÎļþ·¾¶:\n");
gets(fname);
/*´ò¿ªÎļþ*/
fd = open(fn ......
#include "csapp.h"
#define MAX_ARG_NUM 10
#define MAXLINE 512
#define PEER_PORT 1719
struct Udp2SipMsg
{
int argc;
c ......
ÊìϤLinux,C/C++£¬ÓÐÒ»ÄêµÄ¹¤×÷¾Ñ飬ÇëÎÊÔÚÉϺ£ÄÜÄöàÉÙ£¿
ÎÒszµÄ
µÈshµÄ»Ø´ð
¹Ø×¢
Ò»ÄêµÄ¹¤×÷¾ÑéµÄÈË,¸ù¾ÝÄãµÄѧУ,ºÍѧÀúÀ´¿´.
ÎÒÒ»¸öʵÑéÊÒµÄѧ³¤£¬ÉϺ££¬×öLINUXÇý¶¯¿ª·¢£¬2Äê 6000/Ô£¬Êµµ½ÊÖ56 ......
¸ç¸ç½ã½ãÃÇ£¬£¬£¬ÎÒÔÚVISTA ÏÂÓÃVMware °²×°ºìÆì6.5ʱ£¬°²×°µ½Ó²ÅÌ·ÖÇøµÄʱºò£¬×ÜÊdzöÏÖÒ»¸ö¶Ô»°¿ò¡£ÉÏÃæд×Å£º¡°³öÏÖ´íÎó---δÕÒµ½ÒªÔÚÆäÖд´½¨ÐÂÎļþϵͳµÄÓÐЧÉ豸¡£Çë¼ì²éÄãµÄÓ²¼þÒÔÕÒµ½ÎÊÌâµÄÆðÒò¡£¡±ÇëÎÊÔõô½ ......