십진수를 이진수로, 또는 이진수를 십진수로 변환하는 프로그램


반응형
Posted by 랩터 인터내셔널

방화벽에서 특정 포트를 오픈해야 하는 경우 물론 firewall.cpl 이나 wf.msc 등의 GUI 환경에서 설정할 수도 있지만, 대량으로 처리해야 하는 경우라면 커맨드로 작업하는게 훨씬 편리합니다.

간단히 예제를 보여드리겠습니다.

TCP 7777 포트를 오픈하고 싶다면

윈도우 2008 이상

netsh advfirewall firewall add rule name="test" dir=in action=allow protocol=tcp localport=7777


윈도우 2003

netsh firewall add portopening tcp 7777 "test"


위 예제는 가장 일반적인 TCP 포트 인바운트 허용 규칙을 추가하는 것이었고, 좀 더 상세한 작업을 원하신다면 도움말 참고해서 작업하시면 되겠습니다.

윈도우 2008 이상에서는 아래 명령어를 입력해보세요.

netsh advfirewall firewall add rule

아래는 도움말에 나오는 예제입니다.

      messenger.exe에 대해 캡슐화 보안이 적용되지 않은 인바운드 규칙을 추가합니다.
      netsh advfirewall firewall add rule name="allow messenger"
      dir=in program="c:\programfiles\messenger\msmsgs.exe"
      security=authnoencap action=allow
      포트 80에 대한 아웃바운드 규칙을 추가합니다.
      netsh advfirewall firewall add rule name="allow80"
      protocol=TCP dir=out localport=80 action=block
      TCP 포트 80 트래픽에 대해 보안 및 암호화를 요구하는
      인바운드 규칙을 추가합니다.
      netsh advfirewall firewall add rule
      name="Require Encryption for Inbound TCP/80"
      protocol=TCP dir=in localport=80 security=authdynenc
      action=allow
      messenger.exe에 대해 인바운드 규칙을 추가하고 보안을 요청합니다.
      netsh advfirewall firewall add rule name="allow messenger"
      dir=in program="c:\program files\messenger\msmsgs.exe"
      security=authenticate action= allow
     SDDL 문자열로 식별된 그룹 acmedomain\nscanners에 대해
     인증된 방화벽 통과 규칙을 추가합니다.
     netsh advfirewall firewall add rule name="allow scanners"
     dir=in rmtcomputergrp=<SDDL 문자열> action=bypass
     security=authenticate
      UDP 연결에 사용되는 로컬 포트 5000-5010에 대해 아웃바운드 허용 규칙을 추가합니다.
      Add rule name="Allow port range" dir=out protocol=udp localport=5000-5010 action=allow


윈도우 2003 에서는 아래 명령어를 입력해보세요.

netsh firewall add portopening

아래는 도움말에 나오는 예제입니다.

      add portopening TCP 80 MyWebPort                                             
      add portopening UDP 500 IKE ENABLE ALL                                       
      add portopening ALL 53 DNS ENABLE CUSTOM                                     
          157.60.0.1,172.16.0.0/16,10.0.0.0/255.0.0.0,LocalSubnet        
      add portopening protocol = TCP port = 80 name = MyWebPort                    
      add portopening protocol = UDP port = 500 name = IKE mode = ENABLE scope = ALL
      add portopening protocol = ALL port = 53 name = DNS mode = ENABLE            
          scope = CUSTOM addresses =                                     
          157.60.0.1,172.16.0.0/16,10.0.0.0/255.0.0.0,LocalSubnet


어차피 모든 명령어의 사용법을 외울 수는 없습니다. 그리고 외울 필요도 없습니다. 그냥 윈도우에 이런 명령어가 있다는 사실만 알아두시면 되겠습니다. 나중에 필요할 때가 찾아오면 그 때 다시 검색해서 사용하면 되니까요.

※ 동우님 질문에 답변

2008 기준으로 예제 보여드리겠습니다.

O 2000-3000 포트 차단하는 방법
netsh advfirewall firewall add rule name="동우" dir=in action=block protocol=tcp localport=2000-3000

O 적용된 규칙 보기
netsh advfirewall firewall show rule name="동우"

O 삭제하는 방법
netsh advfirewall firewall delete rule name="동우"

적용된 규칙 보기나 삭제하는 방법에 name=all 값을 주면 모든 규칙을 불러오거나 삭제합니다. 자세한 사용법을 확인하려면 아래 명령어를 각각 입력해보세요.

netsh advfirewall firewall add rule
netsh advfirewall firewall delete rule
netsh advfirewall firewall show rule
netsh advfirewall firewall set rule


출처 - http://www.snoopybox.co.kr/1627


1. TCP/UDP 동적 포트 범위 확인

C:\> NETSH INT IPV4 SHOW DYNAMICPORT TCP(UDP)

 

23421C4E5478053C342658

 

 

2. TCP 글로벌 매개 변수, MTU 크기 확인

C:\> NETSH INT TCP SHOW GLOBAL

C:\> NETSH INT IPV4 SHOW INT 

 

214F424E5478053C244381

 

 

 

[참고자료]

Netsh commands for Interface Internet Protocol version 4 (IPv4)
http://technet.microsoft.com/en-us/library/cc731521(v=ws.10).aspx

 

The default dynamic port range for TCP/IP has changed in Windows Vista and in Windows Server 2008
http://support.microsoft.com/kb/929851/en-us

 

How to configure RPC dynamic port allocation to work with firewalls
http://support.microsoft.com/kb/154596


출처 - http://laigo.kr/761

반응형
Posted by 랩터 인터내셔널


■ Internet Router 기본 설정


Router(config)# hostname Internet


Internet(config)# interface fastethernet 0/0


Internet(config-if)# ip address 100.10.10.2 255.255.255.0


Internet(config-if)# no shutdown


Internet(config-if)# exit


Internet(config)# interface fastethernet 1/0


Internet(config-if)# ip address 100.10.20.2 255.255.255.0


Internet(config-if)# no shutdown


Internet(config-if)# exit




■ Head Router 기본 설정


Router(config)# hostname Head


Head(config)# interface fastethernet 0/0


Head(config-if)# ip address 100.10.10.1 255.255.255.0


Head(config-if)# no shutdown


Head(config-if)# exit


Head(config)# interface fastethernet 0/1


Head(config-if)# ip address 192.168.10.1 255.255.255.0


Head(config-if)# no shutdown


Head(config-if)# exit


Head(config)# ip route 192.168.20.0 255.255.255.0 100.10.20.1


Head(config)# ip route 100.10.20.0 255.255.255.0 100.10.10.2




■ Branch Router 기본 설정


Router(config)# hostname Branch


Branch(config)# interface fastethernet 0/0


Branch(config-if)# ip address 100.10.20.1 255.255.255.0


Branch(config-if)# no shutdown


Branch(config-if)# exit


Branch(config)# interface fastethernet 0/1


Branch(config-if)# ip address 192.168.20.1 255.255.255.0


Branch(config-if)# no shutdown


Branch(config-if)# exit


Branch(config)# ip route 192.168.10.0 255.255.255.0 100.10.10.1


Branch(config)# ip route 100.10.10.0 255.255.255.0 100.10.20.2






■ 1차 Ping Test




HEAD Router에 연결된 PC1 (IP : 192.168.10.10)에서


라우터 인터페이스 fa0/1(192.168.10.1), fa0/0(100.10.10.1)까지는 정상적인 ping test가 된다.


그러나 Internet 라우터 인터페이스 fa0/0(100.10.10.2)는 핑이 안된다.


그 이유는 이번 실습에서 인터넷 라우터에는 정적/동적 라우팅 프로토콜을 사용하지 않기 때문이다.












▶▶▶ IPsec Site-to-Site VPN 설정시에 양쪽의 라우터에서 phase 1, phase 2 설정시


Hash (데이터 무결성 체크) 및 암호와 알고리름 등은 어떤 기법을 사용해도 상관없으나,


중요한 것은 양쪽이 동일한 방법을 사용해야 한다.






■ Head 라우터 IPSEC VPN 설정 - Branch 사설구간과의 통신을 위해서




▶ pahse 1 설정 – 마스터 키 생성


Head(config)# crypto isakmp policy 1                                           1~10000까지 사용가능, 낮은 번호 우선


Head(config-isakmp)# authentication pre-share                                  인증은 프리-쉐어 키


Head(config-isakmp)# hash sha                                                  데이터 무결성(Hash) 체크 방법


Head(config-isakmp)# encryption aes 128                                        암호와 알고리즘 방법


Head(config-isakmp)# group 2                                                   Diffie-Hellman Group2


Head(config-isakmp)# lifetime 84600                                            양측 수명이 다르면 짧은 것 적용


Head(config-isakmp)# exit


Head(config)# crypto isakmp key 6 Hoony address 100.10.20.1 255.255.255.255    상대방 사이트 포트 (피어인증)




▶ pahse 2 설정 – Session 키 생성


Head(config)# access-list 110 permit ip 192.168.10.0 0.0.0.255 192.168.20.0 0.0.0.255   보호할 트래픽을 지정하는 ACL


Head(config)# crypto ipsec transform-set IPSEC-VPN ah-md5-hmac esp-aes 128              Hash 및 암호와 방법


Head(cfg-crypto-trans)# exit


Head(config)# crypto map To-Branch 10 ipsec-isakmp                                      To-Branch 설정


Head(config-crypto-map)# match address 110                                              ACL 110과 일치하면


Head(config-crypto-map)# set peer 100.10.20.1                                           피어를 100.10.20.1로 하고


Head(config-crypto-map)# set transform-set IPSEC-VPN                                    트랜스폼셋 PSEC-VPN을 적용하라


Head(config-crypto-map)# exit


 


▶ 물리적 포트에 IPsec 적용


Head(config)# interface fastethernet 0/0


Head(config-if)# crypto map To-Branch


Head(config-if)# exit


Jan 15 14:58:27.711: %CRYPTO-6-ISAKMP_ON_OFF: ISAKMP is ON






■ Branch 라우터 IPSEC VPN 설정 - Head 사설구간과의 통신을 위해서




▶ pahse 1 설정


Branch(config)# crypto isakmp policy 1


Branch(config-isakmp)# authentication pre-share


Branch(config-isakmp)# hash sha


Branch(config-isakmp)# encryption aes 128


Branch(config-isakmp)# group 2


Branch(config-isakmp)# lifetime 84600


Branch(config-isakmp)# exit


Branch(config)# crypto isakmp key 6 Hoony address 100.10.10.1 255.255.255.255




▶ pahse 2 설정


Branch(config)# access-listt 120 permit ip 192.168.20.0 0.0.0.255 192.168.10.0 0.0.0.255


Branch(config)# crypto ipsec transform-set IPSEC-VPN ah-md5-hmac esp-aes 128


Branch(cfg-crypto-trans)# exit


Branch(config)# crypto map To-Head 10 ipsec-isakmp


Branch(config-crypto-map)# match address 120


Branch(config-crypto-map)# set peer 100.10.10.1


Branch(config-crypto-map)# set transform-set IPSEC-VPN


Branch(config-crypto-map)# exit




▶ 물리적 포트에 IPsec 적용


Branch(config)#


Branch(config)# interface fastethernet 0/0


Branch(config-if)# crypto map To-Head


Branch(config-if)# exit


Jan 15 15:00:16.911: %CRYPTO-6-ISAKMP_ON_OFF: ISAKMP is ON






■ HEAD 라우터와 Branch 라우터에 Site-to-Site VPN 설정 후 통신 테스트


 - PC1 (IP : 192.168.10.10)에서 PC2 (IP : 192.168.20.10)으로 Ping Test








정상적으로 통신이 되고 있음을 확인





■ Branch 라우터에서 인터넷 구간에 연결된 물리적 인터페이스 fastethernet 0/0를 Wireshark 로 캡쳐










 


■ PC2의 물리적 인터페이스의 트래픽 WireShark로 확인


 - 출발지 / 도착지 IP 주소와 어떤 프로토콜로 트래픽이 오가는지 확인 할 수 있다.






출처 - http://things.blog.me/220242263076

반응형
Posted by 랩터 인터내셔널