기본 콘텐츠로 건너뛰기

6월, 2016의 게시물 표시

리눅스 기본 사용 정리 하기

Ubuntu * 명령어가 아닌 파일 정보에서 직접삭제 vi /var/lib/dpkg/status 자신이 지울려는 패키지를 검색후 Package:.. 시작 하는 부분을 지운후 저장한다 * 네트웍 확인 변경하기 - 정보 변경 파일 #vi /etc/network/interfaces - 네트웍 정보 내리기 #ifdown eth0 - 네트웍 변경 적용 #ifup eth - 적용 정보보기 #ifconfig * root 사용으로 변경하기 #sudo passwd root 패스워드 두번 입력하기 #su #vi /etc/ssh/sshd_config 변경 PermitRootLogin without-password PermitRootLogin yes 저장후 service ssh restart * 리눅스 정보 변경 파일 vim /etc/lsb-release vim /etc/issue vim /etc/os-release vim /etc/issue.net VIM /etc/update-motd.d/00-header * 커널 업데이트 하기 #uname -a #apt-get update #apt-get install -y --force-yes linux-headers-generic-lts-trusty linux-image-generic-lts-trusty CentOS Linux 공통 *설치 버전 확인 # lsb_release -a # uname -a *검색 - 파일안에 있는 특정 문자열을 찾고 싶을때 명령어 : grep -r "찾을 문자열" ./*      ex : grep -r "aaa" ./*        위의 ex를 설명드리면 ./(현재 폴더 아래 모든 파일에서) aaa라는 문자열이 있는지 찾아라!! 단 하위 디렉토리 모두에서(-r) 입니다. - 특정파일 찾기 #whereis java 파일 찾기 path에

리눅스 문서 내용 검색하기

명령어 : grep -r "찾을 문자열" ./*      ex : grep -r "aaa" ./*       위의 ex를 설명드리면 ./(현재 폴더 아래 모든 파일에서) aaa라는 문자열이 있는지 찾아라!! 단 하위 디렉토리 모두에서(-r) 입니다. 파일 권한 변경 #chmod 777 123.txt

error lsb_release

Step 1 : Learning that the package for lsb_release is lsb-release root@vm1:/usr/bin# apt-get autoremove lsb_release Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package lsb_release root@vm1:/usr/bin# apt-get install lsb_release Reading package lists... Done Building dependency tree Reading state information... Done E: Unable to locate package lsb_release Step 2 : removing and installing lsb_release root@vm1:/usr/bin# apt-get autoremove lsb-release Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: lsb-release python-central 0 upgraded, 0 newly installed, 2 to remove and 27 not upgraded. After this operation, 487 kB disk space will be freed. Do you want to continue [Y/n]? Y (Reading database ... 99295 files and directories currently installed.) Removing lsb-release ... Removing python-central ... Processing triggers for ma

rsync 설치하기

CentOS yum install rsync Ubuntu apt-get install rsync 1) 먼저 동일 서버에서 디렉토리간 동기화 방법입니다. $rsync -avz /home/user1/one   /home/user1/two 2) 다음은  다른 서버로 부터 동기화 하는 예 입니다. - rsync 데몬을 이용하는 방법  (HOSTIP::/path 형식사용 또는  rsync:://  형식사용 ) (또는  rsync 데몬을 이용하되 ssh 컨넥션 이용하는 방법) - 리모트 쉘 ( ssh,  rsh )  를 이용하는 방법   (  HOSTIP:/path  형식사용) rsync 데몬을 명령줄에서의 두가지 방법차이는 콜론(:) 개수 차이 입니다. 콜론 개수에 따라 rsync는 리모트 쉘을 이용할지 리모트 rsync 데몬을 이용할지를 결정합니다.   첫번째 원격 접근 방법인 rsync데몬을 이용하게 되면 대상 호스트에 inetd (873포트) 에 설정을 하여 항상 데몬이 뜰 수 있도록  해주어야 하며 기본적으로 전송간 암호화는 되지 않습니다. (여기에 ssh 컨넥션을 이용하는 방법을 추가해서 암호화가 되도록 해줄 수 도 있긴 합니다.)  두번째 원격접근 방법인 리모트쉘을 이용하는 방법을 사용하게 되면 통상 ssh (22번포트)를 사용하게 되고 더불어 자동으로 암호화된 세션안에서 통신을 하게 됩니다. 별도로 데몬 설정도 불필요합니다. 여기에서는 두번째 방법인 리모트쉘을 이용하는 방법을 사용하게 될 것 입니다.   리모트쉘(ssh) 를 이용하는 전제는 ssh 패키지가 설치 되어있어야합니다. 만일 설치전이라면 ssh부터 설치하시기 바랍니다. (리모트,로컬 양쪽에 설치 되어있어야 합니다.) $sudo apt-get install ssh 동기화 시작 $rsync -avz user2@192.168.1.51:/home/user2/three two 51번 호스트의 /home/user2/three 원본 경로전체를 two 로 동기

안드로이드 오류

참고 사이트:   https://developer.android.com/topic/libraries/support-library/setup.html#add-library error: Error retrieving parent for item: No resource found that matches the given name ‘Theme.AppCompat.Light’. styles.xml 오류가 발생한 프로젝트 에서 속성(Properties) > Android > Library > Add

Using netfilter in a multi-threaded program

This was very helpful. However I think I'm not quite to the end of this path yet. I have the following rules in the mangle section of my iptables: iptables -t mangle -A PREROUTING -p tcp --dport 9999 -j NFQUEUE --queue-balance 0:1 iptables -t mangle -A PREROUTING -p tcp --sport 9999 -j NFQUEUE --queue-balance 0:1 I create 2 threads.Each thread does a nfq_open. So far so good. Thread 1 has his nfq_handle and thread 2 has his nfq_handle. Thread 1 does a nfq_create_queue on queue 0, and Thread 2 does a nfq_create_queue on queue 1. Each thread then opens a netlink handle. Each thread does this independently with the handle returned from nfq_open. Each thread gets an independent fd. When I run, only one thread receives traffic (queue 0 on thread #1). I am using iperf -P 8 for example (8 simultaneous threads/connections). Frankly I must be missing something since I don't see any relationship between the result of nfq_create_queue (which presumably binds to the queue number

Ubuntu(우분투) mysql 삭제/재설치

sudo /etc/init.d/mysql stop sudo apt-get remove --purge mysql-server mysql-client sudo netstat -tap | grep mysql sudo apt-get remove --purge mysql-server* sudo apt-get remove --purge mysql-client* 다른 서비가 사용중이면 제거 되지 않는다. Package 'mysql-client' is not installed, so not removed Package 'mysql-server' is not installed, so not removed mysql 사용중인 프로그램을 종료후 제거를 다시 시도한다.

설치,삭제, MySQL(Maria DB) root 계정 외부접속 허용

모든 패지지 목록 /var/lib/dpkg/status DB 삭제 apt-get autoremove --purge mariadb-server rm -rf /var/lib/mysql rm -rf /etc/mysql 설치 apt-get install mariadb-server 외부 접속 설정 mysql -u root -p use mysql grant all privileges on *.* to 'root'@'%' identified by 'password'; flush privileges; 파일 위치 보기 show variables like 'datadir'; mv /var/lib/mysql/ib_logfile0 /var/lib/mysql/ib_logfile0.bak mv /var/lib/mysql/ib_logfile1 /var/lib/mysql/ib_logfile1.bak error... error: ' Access denied for user 'debian-sys-maint'@'localhost'  (using password: YES)' neo@thematrix:~$ sudo cat /etc/mysql/debian.cnf The contents of the file should look something like the following: # Automatically generated for Debian scripts. DO NOT TOUCH! [client] host     = localhost user     = debian-sys-maint password = n4aSHUP04s1J32X5 socket   = /var/run/mysqld/mysqld.sock [mysql_upgrade] user     = debian-sys-maint password = n4aSHUP04s1J32X5 s

netlink: memory mapped I/O

The following patches contain an implementation of memory mapped I/O for netlink, rebased onto the current net-next tree. The implementation is modelled after AF_PACKET memory mapped I/O with a few differences: - In order to perform memory mapped I/O to userspace, the kernel allocates   skbs with the data area pointing to the data area of the mapped frames.   All netlink subsystems assume a linear data area, so for the sake of   simplicity, the mapped data area is not attached to the paged area but   to skb->data. This requires introduction of a special skb alloction   function that just allocates an skb head without the data area. Since this   is a quite rare use case, I introduced a new function based on __alloc_skb   instead of splitting it up into head and data alloction. The alternative   would be to   introduce an __alloc_skb_head and __alloc_skb_data function,   which would actually be useful for a specific error case in memory mapped   netlink, but would requir

Blogger 사용법

내가 사용하다가 불편해서 찾은 방법입니다.  1. 코드를 복사 해서 붙어 넣을때 내용 2. 분류(카테고리) 메뉴 만들기  - 글쓰기 옆에 보면 태그에 분류를 넣으며 됩니다. - 블로그 디자인에 가서 위젯(태그) 추가

Iptables-1.6.0

http://www.linuxfromscratch.org/blfs/view/cvs/postlfs/iptables.html Introduction to Iptables The next part of this chapter deals with firewalls. The principal firewall tool for Linux is  Iptables . You will need to install  Iptables  if you intend on using any form of a firewall. This package is known to build and work properly using an LFS-7.9 platform. This package is known to build properly using the gcc-6 compiler

c 언어 형 지정자

@ 형식지정자 %d : 정수(10진수) %ld : 변수형 중 long형 %c : 문자(문자 하나) %s : 문자열("apple" 같이 여러문자) %f : 실수(10진수, 11.34와 같이 소수점 이하에 값이 있는경우) %lf : 변수형 중 double형(8byte) %u : unsigned int 와 같이 부호없는 정수(10진수) %lu : unsigned long %x, %X, %lx, %lX : 부호없는(unsigned) 16진수 %o, %lo : 부호없는 8진수

10G ixgbe

ixgbe-4.3.15 src 폴더에서 make, make install 모듈 제거 modprobe -r ixgbe 모듈 시작 modprobe ixgbe allow_unsupported_sfp=1 //설치 확인 ifconfig -a p5p2      Link encap:Ethernet  HWaddr 00:1b:21:5c:fb:25           BROADCAST MULTICAST  MTU:1500  Metric:1           RX packets:0 errors:0 dropped:0 overruns:0 frame:0           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B) ethtool p5p2 Supported ports: [ FIBRE ]         Supported link modes:   10000baseT/Full         Supported pause frame use: No         Supports auto-negotiation: No         Advertised link modes:  10000baseT/Full         Advertised pause frame use: Symmetric         Advertised auto-negotiation: No         Speed: Unknown!         Duplex: Unknown! (255)         Port: FIBRE         PHYAD: 0         Transceiver: external         Auto-negotiation: off         Supports Wake-on: d         Wake-on: d         Current mes

NFQUEUE 멀티큐 설정

-A PREROUTING -p tcp -m tcp --dport 9999 -j NFQUEUE --queue-balance 0:1 -A FORWARD -i eth0 -o eth1 -m state --state RELATED,ESTABLISHED -j NFQUEUE --queue-num 0 -A FORWARD -i eth1 -o eth0 -j NFQUEUE --queue-num 1 cat /proc/net/netfilter/nfnetlink_queue iptables -L OUTPUT Improving Snort_inline’s NFQ performance Posted on  23/01/2008 5 When using Snort_inline with NFQ support, it’s likely that at some point you’ve seen messages like these on the console:  packet recv contents failure: No buffer space available . When the messages are appearing Snort_inline slows down significantly. I’ve been trying to find out why. There are a number of setting that influence NFQ performance. One of them is the NFQ queue maximum length. This is a value in packets. Snort_inline takes an argument to modify the buffer length: –queue-maxlen 5000 (note: there are two dashes before queue-maxlen). That’s not enough though. The following settings increase the buffer that NFQ seems to

netfilter

http://www.netfilter.org/ : 네트웍 정보를 확인할 수 있다 netlink: memory mapped I/O https://lwn.net/Articles/512442/ 참조:https://hydra.geht.net/tino/howto/linux/net/netfilter/ http://netfilter.org/projects/libnetfilter_queue/doxygen/nfqnl__test_8c_source.html nfqnl_test.c 00001 00002 #include 00003 #include 00004 #include 00005 #include 00006 #include 00007 #include /* for NF_ACCEPT */ 00008 00009 #include 00010 00011 /* returns packet id */ 00012 static u_int32_t print_pkt (struct nfq_data *tb) 00013 { 00014 int id = 0; 00015 struct nfqnl_msg_packet_hdr *ph; 00016 struct nfqnl_msg_packet_hw *hwph; 00017 u_int32_t mark,ifi; 00018 int ret; 00019 unsigned char *data; 00020 00021 ph = nfq_get_msg_packet_hdr(tb); 00022 if (ph) { 00023 id = ntohl(ph->packet_id); 00024 printf("hw_protocol=0x%04x hook=%u id=%u ", 00025 ntohs(