어이 없는 네트워크 대역이라 생각 되지만.. IP프로토콜에 정의된 대역이였다..
http://en.wikipedia.org/wiki/Link-local_address
번역해서 요약해보자면.. 내부내트워크의 연결 혹은 P-to-P 간의 연결을 위해 만들어진 IP대역이고 라우터에서 처리해주지 않는다. DHCP나 다른 ip 설정메소드에 실해 했을 설정이 된다는것 같네요.. 발번역 죄송.
snmpwalk -v2c -c read-community 호스트IP .
SNMPv2-MIB::sysDescr.0 = STRING: Linux ns.aaa.or.kr 2.6.6-8hl #1 Tue Oct 12 00:22:29 KST 2004 i686
SNMPv2-MIB::sysObjectID.0 = OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
SNMPv2-MIB::sysUpTime.0 = Timeticks: (54657) 0:09:06.57
SNMPv2-MIB::sysContact.0 = STRING: Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
snmpwalk -v2c -c read-community -O f 호스트IP .
.iso.org.dod.internet.mgmt.mib-2.system.sysDescr.0 = STRING: Linux ns.aaa.or.kr 2.6.6-8hl #1 Tue Oct 12 00:22:29 KST 2004 i686
.iso.org.dod.internet.mgmt.mib-2.system.sysObjectID.0 = OID: .iso.org.dod.internet.private.enterprises.netSnmp.netSnmpEnumerations.netSnmpAgentOIDs.10
.iso.org.dod.internet.mgmt.mib-2.system.sysUpTime.0 = Timeticks: (47124) 0:07:51.24
.iso.org.dod.internet.mgmt.mib-2.system.sysContact.0 = STRING: Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
snmpwalk -v2c -c read-community -O fn 호스트IP .
.1.3.6.1.2.1.1.1.0 = STRING: Linux ns.aaa.or.kr 2.6.6-8hl #1 Tue Oct 12 00:22:29 KST 2004 i686
.1.3.6.1.2.1.1.2.0 = OID: .1.3.6.1.4.1.8072.3.2.10
.1.3.6.1.2.1.1.3.0 = Timeticks: (76934) 0:12:49.34
.1.3.6.1.2.1.1.4.0 = STRING: Root <root@localhost> (configure /etc/snmp/snmp.local.conf)
출처 : Tong - Gold_Sky님의 Linux 통
[출처] snmpwalk 사용법|작성자 McDG
############################################################################
저작권은 위 글쓴 유영창 님에게 있음
출처 : KELP(Korea Embedded Linux Project) 에서 가져 왔습니다.
Linux VPN Guide will help you to create a Linux-based VPN server which can be accessed from any Windows client (primarily Windows XP, but can be extended to work with older Windows operating systems such as Windows 2000 or 95/98/NT). I wrote this guide because of the pain I went through to get VPN up and running at my work. After a couple of days of struggling and heavy debugging I was able to set up a VPN server on Fedora Core 2 and 3 with latest updates. I decided that VPN installation should not be such a nightmare and tried to make everything as simple as possible in this guide.
1) Who should use this guide?
If you have a
private network that you want to be able to access remotely in VPN
(virtual private networking) environment (for example, if you have
servers at your workplace that are firewalled from outside with
internal IP addresses such as 192.168.x.x and you want to be able to
access them from the internet), this guide is definitely for you.
2) Can this guide be used on production servers?
To
be honest, I'm not sure yet. I have been using this VPN solution for a
while now and haven't had any problems so far. But if you notice any
performance/compatibility/stability related issues, please let me know.
3) What about security?
VPN
is a secure virtual tunnel, which means security is built into it.
However, just like any "bullet-proof" solution out there, it has its
own security-related issues. First of all, this guide only shows you
how to use PSK (pre-shared security key) method of authenticating a VPN
tunnel. Your VPN tunnel is encrypted with this security key and in case
the key is stolen (or broken with a brute-force attack), your security
is compromised. You can use other methods of encryption based on SSL
(secure socket layer), but the process of setting up a VPN server and
connecting the clients to it is rather complicated. You can refer to Jacco's VPN tutorial
to set up a VPN solution based on SSL. As long as your PSK is very
long, unguessable and not prone to a simple brute-force, you should not
worry about security.
4) On what operating systems has this guide been tested on?
Installation
has been successfully tested on Redhat Linux 9.0 and Fedora Core
1/2/3/4, but it should also work on any other linux flavor. For BSD
systems, you would have to obtain source files for OpenSWAN and change
some configuration options on l2tpd to be able to compile everything
successfully.
5) Stuff we'll be needing (sources)
Download the following sources to a src directory i.e. /usr/local/src
- OpenSWAN 2.4.0 from http://www.openswan.org | Mirror
- l2tpd 0.69 from http://www.l2tpd.org | Mirror
- l2tpd Legacy PTY patch from this site
- l2tpd SysV PTY patch from this site
- l2tpd startup file from this site
6) Assumptions
It
is assumed that ppp is already installed on the system and you are
running the latest version of linux kernel 2.4 or 2.6. You can check if
you have ppp installed on the system by running a query in your package
manager ("rpm -q -a | grep ppp" in Redhat or Fedora). You can check the
kernel version by running "cat /proc/version".
7) OpenSWAN installation and configuration
I
recommend downloading an RPM from openswan.org instead of the source
tarball, since the RPM has the patches integrated to fit your system.
In case you want to compile OpenSWAN yourself, you will have to find
out which patches you need for your system. Compilation and
installation from source is pretty straightforward - just read the
README file and follow the instructions. If you want to install from
RPM, first make sure that you don't have any previous versions of
OpenSWAN in your system. Most probably you don't, but Fedora Core 3 was
shipped with an old version of OpenSWAN and you need to remove it
before installing OpenSWAN from source or RPM. Run the following
command to see if you have the package: "rpm -q -a | grep openswan". If
the query returns anything, remove it by typing "rpm -e openswan". If
openswan is not installed, proceed with the installation.
# cd /usr/local/src
# rpm -i openswan-2.4.0-1.i386.rpm
# rpm -i openswan-doc-2.4.0-1.i386.rpm
The openswan-doc rpm file includes all the documentation which you might need in the future.
The OpenSWAN installation has a sample ipsec.conf file included. Let's go ahead and rename it:
# mv /etc/ipsec.conf /etc/ipsec.conf.old
Now copy-paste the following into /etc/ipsec.conf
version 2.0
config setup
interfaces=%defaultroute
klipsdebug=none
plutodebug=none
overridemtu=1410
nat_traversal=yes
virtual_private=%v4:10.0.0.0/8,%v4:172.16.0.0/12,%v4:192.168.0.0/16
conn %default
keyingtries=3
compress=yes
disablearrivalcheck=no
authby=secret
type=tunnel
keyexchange=ike
ikelifetime=240m
keylife=60m
conn roadwarrior-net
leftsubnet=192.168.0.0/16
also=roadwarrior
conn roadwarrior-all
leftsubnet=0.0.0.0/0
also=roadwarrior
conn roadwarrior-l2tp
leftprotoport=17/0
rightprotoport=17/1701
also=roadwarrior
conn roadwarrior-l2tp-updatedwin
leftprotoport=17/1701
rightprotoport=17/1701
also=roadwarrior
conn roadwarrior
pfs=no
left=150.150.150.150
leftnexthop=150.150.150.1
right=%any
rightsubnet=vhost:%no,%priv
auto=add
#Disable Opportunistic Encryption
include /etc/ipsec.d/examples/no_oe.conf
Don't forget to replace "150.150.150.150" with your external IP
address and "150.150.150.1" with your default gateway. I'm not going to
explain what each line above does. If you want to find out for
yourself, please refer to OpenSWAN documentation. The above configuration should work for most people, though.
Now edit the file "/etc/ipsec.secrets" and put the following:
150.150.150.150 %any: PSK "a_very_long_string_up_to_256_characters"
The format of the file is: "external_network_address
connecting_from: PSK password". Change "150.150.150.150" to your
external IP address. If you want to be able to access the network from
anywhere on the Internet, leave "%any" intact. I recommend specifying
the IP address of the machine that will be used to initiate VPN
connections for security reasons though. PSK stands for "Pre-Shared
Key" - it's the key that will be shared by both the server and the
client for authentication. Make sure that the key is long (up to 256
characters) and very random. Every client trying to establish a VPN
connection will have to provide this pre-shared key.
8) l2tpd installation and configuration
First
of all, let me give you some information on l2tpd. The project started
out really well and a big community was involved in its development.
But seems like the project has been suspended for some reason and there
haven't been any new releases of l2tpd since version 0.69 which is more
than a year old. Latest versions of the linux distributions such as
Fedora and Mandrake are compiled with a new SysV pty system. The
current version of l2tpd only supports the old pty system and therefore
will not work on these distros unless its patched. Jacco de Leeuw talks about this problem in his detailed VPN guide here. An alternative is to switch to rp-l2tp,
which is another l2tpd daemon. But it is not a good way out, since it
does not support automatic IP allocations to new connections. Another
solution is to recompile the kernel with "Legacy (BSD) PTY support",
but most people simply don't know how to do that or are too scared to
do it. Recompiling the kernel might be a big problem for those who
don't have physical access to the machine. After many hours of
googling, I was able to find some patches that fix current l2tpd issues
and add some features such as binding l2tpd to a specific IP address.
Now here is the interesting part - the rp-l2tp package contains pty.c
code that is known to work with the new pty system. I tried to simply
copy-paste the script into l2tpd pty.c file, modified l2tpd.c to call
"pty_get" instead of the old "getPtyMaster", removed all other pty
calls and it worked! I was able to test l2tpd setup successfully on a
Fedora Core 3 machine without recompiling the kernel
I have
included two patches on this page. If you have a recent version of a
linux distribution with 2.6 kernel, go ahead and download the file
"l2tpd-0.69.sysv.patch". If you have an older version of linux with the
old pty system, go ahead and download the file "l2tpd-0.69.lpty.patch".
Now, let's install l2tpd and apply the patch:
# cd /usr/local/src
# tar zxf l2tpd-0.69.tar.gz
# mv l2tpd-0.69.sysv.patch l2tpd-0.69/
# mv l2tpd /etc/rc.d/init.d/
# cd l2tpd-0.69
# patch < l2tpd-0.69.sysv.patch
# make
# cp l2tpd /usr/sbin
# chmod 755 /usr/sbin/l2tpd
Running "make" should compile an l2tpd executable without errors. You might get a couple of warnings, but no fatal errors. If you try to compile the source without patching it first, you will most probably get compilation errors (especially on systems with a newer gcc). Now configure the startup environment:
# chmod 755 /etc/rc.d/init.d/l2tpd
# chkconfig --add l2tpd
# chkconfig l2tpd on
Let's move on to configuring l2tpd. The configuration files for l2tpd should be placed in "/etc/l2tpd" folder. Go ahead and create the folder, then copy paste the following into l2tpd.conf:
[global]
port = 1701
[lns default]
ip range = 192.168.1.101-192.168.1.254
local ip = 192.168.1.100
require chap = yes
refuse pap = yes
require authentication = yes
name = LinuxVPN
ppp debug = yes
pppoptfile = /etc/ppp/options.l2tpd
length bit = yes
The "ip range" line is the start and the end pool of the IP
addresses the clients will be given when they establish a VPN
connection (on their end). The "local ip" is server IP address - it's
used only when at least one connection is established. If you have a
different internal network, go ahead and change both lines. Everything
else should work for most people. Again, if you want to find out what
each line does, please feel free to refer to l2tpd documentation.
9) PPP configuration
L2TP
tunnels through PPP, which is why we need to configure it to work with
l2tpd. The l2tpd configuration above specifies the
"/etc/ppp/options.l2tpd" file as "pppoptfile" (PPP options file). Go
ahead and create this file and copy-paste the following:
ipcp-accept-local
ipcp-accept-remote
ms-dns 192.168.1.2
ms-wins 192.168.1.3
noccp
auth
crtscts
idle 1800
mtu 1410
mru 1410
nodefaultroute
debug
lock
proxyarp
connect-delay 5000
silent
Change the line "ms-dns" to your real DNS server and "ms-wins" to your WINS server (if you have any).
Now
let's create the authentication files. We use CHAP for PPP
authentication. Go ahead and edit the file "/etc/ppp/chap-secrets". The
format of this file should be "client server secret IP addresses". Here
is a sample file:
# Secrets for authentication using CHAP
# client server secret IP addresses
username * "password" 192.168.1.0/24
* username "password" 192.168.1.0/24
You need two lines for each username because it's a two-sided
authentication - one from client to server and one from server to
client. Both the password and the IP address pool should be the same
for both lines. The IP address network that we specify here
(192.168.1.0/24) means "allow this username to get an IP address in the
range 192.168.1.0 - 192.168.1.255". The l2tpd configuration file above
specifies the range to be 192.168.1.101-192.168.1.254, so only the IPs
in this range are given to the client on successful authentication. You
can change the networks and subnets in both files as needed. If you
need more than one account to be able to access the server, go ahead
and add it in the same format.
10) Starting and testing VPN
Everything is installed and configured. Let's go ahead and start the daemons:
Starting l2tpd:
/etc/rc.d/init.d/l2tpd start
Starting l2tpd: [ OK ]
Starting OpenSWAN:
/etc/rc.d/init.d/ipsec start
ipsec_setup: Starting Openswan IPsec 2.4.0...
ipsec_setup: insmod /lib/modules/2.6.10-1.741_FC3/kernel/net/key/af_key.ko
ipsec_setup: insmod /lib/modules/2.6.10-1.741_FC3/kernel/net/ipv4/xfrm4_tunnel.ko
Take a look at /var/log/messages and /var/log/secure and make sure
there are no errors. You should see notification messages such as
"l2tpd: l2tpd startup succeeded" and "ipsec_setup: Starting Openswan
IPsec 2.4.0...". If there are no errors, everything is up and running -
proceed to next step.
11) Firewall configuration
To
be able to route packets from your external to internal interfaces,
packet forwarding must be turned on. Edit /etc/sysctl.conf and change
"net.ipv4.ip_forward = 0" to "net.ipv4.ip_forward = 1". If you don't
have that file, just type "echo 1 > /proc/sys/net/ipv4/ip_forward"
and add this line to your /etc/rc.d/rc.local file. Restart your
networking by typing "/etc/rc.d/init.d/network restart" or whichever
way you restart your network interfaces.
Make sure that the
following ports are open: UDP 500 & 4500, TCP 4500. If any of these
ports are blocked, VPN will not work. If you have Redhat/Fedora
distributions with iptables, insert these lines into your
/etc/sysconfig/iptables file, before REJECT line at the end of the file:
One more thing you should keep in mind while changing your firewall configuration - your internal and VPN network should be trusted, otherwise your firewall will keep rejecting packets from 192.168.x.x network into your LAN. I solve this by simply adding the first two lines above into my iptables file. The interface eth0 is external and eth1 is physically inside my internal network, of course
-A RH-Firewall-1-INPUT -i ppp+ -j ACCEPT
-A RH-Firewall-1-INPUT -i eth1 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 500 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 4500 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m udp -p udp --dport 4500 -j ACCEPT


TCP/IP 프로토콜이 설계 될때 datagram 자체가 전혀 암호화 하지 않고 전송되게 되어 있었습니다. 따라서, 네트웍 상을 이동하는 패킷들을 모아서 순서에 맞게 재조합을 하면 원래의 데이타를 얻을 수가 있죠.. 이러한 방법을 sniffing이라고 합니다. 킁킁거리다.. 라는 뜻을 가지구요..
이렇게 되면, 원격 호스트에서 접속시 아이디랑, 비번을 가로챌 수가 있겠죠? 이것은 이더넷 상에서 데이타를 여러호스트를 대상으로 소스 호스트에서 뿌려버립니다. 그럼.. 각 호스트들은 자신의 데이타가 아니면 그냥 흘려보내고, 자신의 데이타면 그것을 받아서 어떤 일을 하게 됩니다.
원래 시스템은 기본으로 자기것만 받도록 설정되어 있습니다. 그런데, 이 스니퍼를 돌리게 되면 자신의 시스템의 인터페이스가 열리고, 아무거나 받아들이게 되죠.. 이러한 모드를 promiscuous mode 라고 합니다. 만약 자신의 시스템이 promiscuous mode로 돌아간다면 스니퍼가 돌아가고 있다고 의심하심이....
보통 인터넷에서 많이 볼수 있는 스니퍼의 경우 telnet, ftp, rlogin, email 등의 처음 128byte를 잡아서 log 파일로 남김니다.
이런 스니퍼를 사용한 해킹의 경우 치사하지만 이것만큼 편하고 좋은 해킹툴 또한 구하기 힘들죠. 스니퍼를 해킹에 이용하지 말고 시스템 보안에 이용한다면 더 큰 행복이~
실제로 시스템에 스니터를 설치해 두었다가 제 홈디렉토리를 해킹한 사람을 잡은 적이 있습니다.
<방어는...> promiscuous mode인지 아닌지 검사하는 유틸이 있습니다. cpm(check promiscuous mode) 이라는 건데.. ftp://cert.org/pub/tools 에 가시면 구하실수 있습니다.
또한 rlogin이나, rsh 대신에 사용할 수 있는 ssh, slogin 이 있습니다. 이것은 패킷을 암호화 해서 전송하므로 sniffer에 잡혔다 하더라도 안전하겠죠.. 100% 안전하다고 할 수는 없습니다... 똑똑한 사람들 한테는...
그리고, S/Key라는 것이 있습니다. 이것은 원격 호스트로의 접속에 있어서 one time password를 생성해 줍니다. 때문에, sniffing에도 어느정도 대응할 수 있습니다. 로긴할 때마다 패스워드가 변경되고, 새로운 패스워드를 보여줍니다. 따라서 자신의 비번을 sniffing당했다 하더라고 바뀐 비번이니깐.. 상관없죠.. 문제는 매번 비번이 바뀜으로 자신의 비번을 잊어버릴 위험이...
마지막으로 sniffing 한 결과를 조금 보여드리죠.. 호스트명은 보여드릴수가 없네요..
참고로 이 제어는 오직 root 만이 할 수 있으며 promisc 설정은 ifconfig eth0 promisc 를 하면 되고 이 설정을 해제하는 방법은 ifconfig eth0 -promisc 입니다. 따라서 스니핑이 돌고 있다면 이미 관리자 권한을 빼앗긴 것이라 생각하셔도 무방합니다..
-- TCP/IP LOG -- TM: Thu Feb 15 11:21:16 --
PATH: xxxxx.xxxxx.ac.kr(1023) => xxxxx.xxxxx.ac.kr(rlogin)
STAT: Thu Feb 15 11:22:41, 163 pkts, 128 bytes [DATA LIMIT]
DATA: guest
: duck
: xterm/9600/7
: (255)(255)ss
: ^X
: P
: dhlfldkssud
: duck
: dhfldkssud
:
: tlen^H^H^H^H^Hsetenv d^H^Id^H^HDISPLAY ^[[D143.248.x.x:.^H0.0
:
:
: han&
: han&
--
-- TCP/IP LOG -- TM: Tue Feb 15 12:20:58 --
PATH: xxxxx.xxxxx.ac.kr(2857) => xxxx(telnet)
STAT: Tue Mar 5 10:21:13, 52 pkts, 65 bytes [TH_FIN]
DATA: (255)(253)^C(255)(251)^X(255)(250)^X
: VT100(255)(240)(255)(253)^A(255)(252)^Asljdflsdkjfl
: wlfjddl>
: exit(127)(127)(127)(127)(127)(127)(127)(127)exit
:
--
-- TCP/IP LOG -- TM: Tue Feb 15 13:01:36 --
PATH: xxxx.xxxxx.ac.kr(1953) => 143.248.x.x(ftp)
STAT: Sun Apr 14 17:02:13, 14 pkts, 49 bytes [TH_FIN]
DATA: USER mile
:
: PASS ladysun
:
: CWD backup
:
: NLST
:
: QUIT
:
--
이것이 바로 스니핑이 가능한 이유이지요...
결론적으로 가장 중요한 핵심 포인트는 "ARP" 와 "Broadcasting" 입니다. 이외 더 많은 내용들은 관련 서적이나 관련 사이트를 참고하시기 바랍니다..
펌d. From.
http://superuser.co.kr/superuserboard/view.html?id=547&code=security&start=210&position=
관련사이트에서 퍼옴