랜선끼고 ifup or ifconfig eth$N up
IFF_UP = 1 // Interface is up
IFF_RUNNING = 1 // Resources allocated

랜선끼고 ifdown or ifconfig eth$N down
IFF_UP = 0 // Interface is up
IFF_RUNNING = 0 // Resources allocated

랜선뽑고 ifup or ifconfig eth$N up
IFF_UP = 1 // Interface is up
IFF_RUNNING = 0 // Resources allocated

랜선뽑고 ifdown or ifconfig eth$N down
IFF_UP = 0 // Interface is up
IFF_RUNNING = 0 // Resources allocated



그렇다면 if, ifconfig 명령의 차이는?

RHET5 기준 (https://access.redhat.com/solutions/27166)



  • An "ifconfig" command and "ifup" or "ifdown" command can activate network interfaces. "ifconfig" directly controls network interfaces, however "ifup" or "ifdown" executes "/etc/sysconfig/network-scripts/ifup-" or "ifdown-" scripts. The scripts use an ip command.

  • "ifconfig" and "ip" commands use ioctl() to activate or deactivate network interfaces. "ifconfig" flags network interfaces 'IFF_UP | IFF_RUNNING', however "ip" flags that 'IFF_UP'.

  • An "ifconfig up eth0" activates eth0 but does not setup IP addresses, however an "ifup eth0" setup IP addresses or other options based by an ifcfg-eth0, because the "ifup" uses an "ifup-eth*" script.

  • The ifup command will also configure any static routes that are configured in the network-scripts directory. The ifconfig command will not.


반응형

'Linux' 카테고리의 다른 글

[cut] 명령어 -f 옵션으로 가장 왼쪽에 있는 마지막 필드 가져오기  (1764) 2017.04.07
[문자열 자르기] awk, cut을 이용  (1440) 2017.04.06
[UDP] 특성  (1796) 2016.12.06
[Linux] Bonding 본딩 설정  (1281) 2016.12.05
[SQlite3] 자주쓰는 명령어  (448) 2016.11.23

UDP 특성

  • 패킷 유실
    • UDP를 받아들이는 입장에서는 들어오는 UDP를 memcpy 로 큐에 밀어넣는데 발생하는 비용이 소요되고 이 큐에 있는 것을 다른 쓰레드에서 소비하는데 제대로 소비하지 못하면 큐도 밀려 UDP 패킷 유실이 발생 이것은 최소한의 소비 패턴과 패킷의 들어오는 발생 빈도를 바탕으로 잘 튜닝을 해야하는 문제입니다. 지훈현서 블로그 참고
    • UDP 헤더의 목적은 UDP 헤더 내 Port # = 2152를 통해 UDP 헤더 다음에 GTP 헤더가 있음을 알리는 것입니다. UDP는 TCP와 달리 재전송 mechanism이 없기 때문에 eNB와 EPC간 전송되는 유저 데이터에 대한 재전송은 불가능하고, 이는 단말(UE)과 목적지(예. naver 서버)간에 TCP 재전송 혹은 응용 레벨의 재전송 방법에 의존해야 합니다.
    • eNB와 EPC간 user data의 모양 [Outer IP][UDP][GTP][Inner IP][TCP or UDP][UE Payload] 참고1 참고2
반응형

'Linux' 카테고리의 다른 글

[문자열 자르기] awk, cut을 이용  (1440) 2017.04.06
ifup, ifdown과 ifconfig up, ifconfig down의 차이 (RHET5 기준)  (1752) 2016.12.13
[Linux] Bonding 본딩 설정  (1281) 2016.12.05
[SQlite3] 자주쓰는 명령어  (448) 2016.11.23
[GDB] 자주 쓰는 명령어  (472) 2016.11.17

Bonding 이란?

-------------


Linux kernel에 내장된 기술

2개 이상의 Network Interface Card를 논리적으로 1개의 interface로 묶음

Bandwidth, redundancy 향상

- https://www.kernel.org/doc/Documentation/networking/bonding.txt



Bonding 구성 방법

-----------------


- Interface alias 'bond0:1 bond0:2'를 이용하여 여러 IP 주소 지정

https://oracle-base.com/articles/linux/nic-channel-bonding



- 일반 본딩 설정 링크 모음

http://onecellboy.tistory.com/279


Bonding mode

------------


참고: http://root.so/archives/48


- balance-rr    or 0: 2개의 NIC에 순차적 분배 round robin

- active-backup or 1: 네트워크 이중화

- balance-xor   or 2: src MAC에서 dst MAC으로 비트 연산을 통하여 분배

- broadcast     or 3: 모든 NIC에 동일한 패킷을 broadcast

- 802.3ad       or 4: 802.3ad 지원하는 스위치에서 Dynamic Link Aggregation 정책으로 분배

- balance-tlb   or 5: 내보내지는 트래픽은 분산되어 송출

- balance-alb   or 6: 들어오는 트래픽을 분산 처리하여 수신

반응형

'Linux' 카테고리의 다른 글

ifup, ifdown과 ifconfig up, ifconfig down의 차이 (RHET5 기준)  (1752) 2016.12.13
[UDP] 특성  (1796) 2016.12.06
[SQlite3] 자주쓰는 명령어  (448) 2016.11.23
[GDB] 자주 쓰는 명령어  (472) 2016.11.17
ctags를 cpp에서 사용하려면  (457) 2015.11.19

https://github.com에서 가장 인기 있는 프로젝트를 star 순으로 정렬해서 보고 싶은 경우



github.com의 검색창에서 검색하고 언어 선택


stars:>1



특정 언어까지 선택해서 검색하고 싶으면

예) python으로 구현된 가장 star가 많은 프로젝트 검색


stars:>1 language:python


반응형

reference : http://stackoverflow.com/questions/28400943/python-django-e-mail-form-example


기본 구조 이해에 도움이 많이 되서 저장해둠


A simple example could be:

urls.py

from django.conf.urls import patterns, url
from yourapp import views

urlpatterns = patterns(
    '',
    url(r'^email/$',
        views.email,
        name='email'
        ),
    url(r'^thanks/$',
        views.thanks,
        name='thanks'
        ),
)

forms.py

from django import forms

class ContactForm(forms.Form):

    from_email = forms.EmailField(required=True)
    subject = forms.CharField(required=True)
    message = forms.CharField(widget=forms.Textarea)

views.py

from django.core.mail import send_mail, BadHeaderError
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render, redirect
from yourapp.forms import ContactForm

def email(request):
    if request.method == 'GET':
        form = ContactForm()
    else:
        form = ContactForm(request.POST)
        if form.is_valid():
            subject = form.cleaned_data['subject']
            from_email = form.cleaned_data['from_email']
            message = form.cleaned_data['message']
            try:
                send_mail(subject, message, from_email, ['admin@example.com'])
            except BadHeaderError:
                return HttpResponse('Invalid header found.')
            return redirect('thanks')
    return render(request, "yourapp/email.html", {'form': form})

def thanks(request):
    return HttpResponse('Thank you for your message.')

email.html

<form method="post">
    {% csrf_token %}
    {{ form }}
    <div class="form-actions">
      <button type="submit">Send</button>
    </div>
</form>


반응형

별것 아니지만 자꾸 까먹어서 남김.


DB open from file

% sqlite3 db.sqlite3



MySQL 

SQlite3 

show databases;

.database 

show tables; 

.table 

desc $TABLE 

.schema $TABLE




반응형

'Linux' 카테고리의 다른 글

[UDP] 특성  (1796) 2016.12.06
[Linux] Bonding 본딩 설정  (1281) 2016.12.05
[GDB] 자주 쓰는 명령어  (472) 2016.11.17
ctags를 cpp에서 사용하려면  (457) 2015.11.19
리눅스에서 가장 많은 CPU를 사용하는 프로세스 찾는 명령  (438) 2015.08.06

보통 프로세스가 죽고나서 dump된 core 파일을 보다보니

그때마다 사용하는 명령어를 매번 검색해서 찾기가 불편하여

이곳에 모아서 보려함.



* GDB 명령어

2017.12.29


심볼 테이블에 대해 확인하기 위한 명령어 예시

구조체 안의 정보를 찾아서 확인한다고 봐도 될 것 같다.




(gdb) bt
(gdb) frame 9
#9  0x00002b459abc0e5f in test_GenCancelTrct (pStParser=0x7bb3590, pStTrct=0x2aab1a951e50) at test_Utility.c:834
834 test_Utility.c: 그런 파일이나 디렉토리가 없음.
    in test_Utility.c

(gdb) whatis pStTrct
type = stTrct_t *

(gdb) ptype pStTrct
 type = struct _stTrct_t { ... test_common_msg_t *pStRequest; ... } *

(gdb) ptype pStTrct->pStRequest type = struct { ... test_parsed_msg_t *test_parsed_msg; ... } *

(gdb) ptype pStTrct->pStRequest->test_parsed_msg type = struct { ... test_header_index_t test_header_index[100]; ... } *

(gdb) ptype pStTrct->pStRequest->test_parsed_msg->test_header_index type = struct { ... int test_added_current_sub_index; ... }

(gdb) ptype pStTrct->pStRequest->test_parsed_msg->test_header_index[84].test_current_sub_index type = int

(gdb) p pStTrct->pStRequest->test_parsed_msg->test_header_index[84].test_current_sub_index $1 = 10923


위에서 test_header_index의 배열이 최대 114개까지 사용할 수 있는데

이를 일일이 실행하기 너무 어려움, 개수를 세지도 못하겠음

이렇게 하면 i의 index가 하나씩 증가하면서 위에 보다는 조금 편해짐

하지만 114번 일일이 반복 해야하므로 불편하기는 마찬가지


(gdb) set $i=0 
(gdb) p pTrct->pStRequest->test_parsed_msg.test_header_index[$i++].test_curreut_sub_index


while문을 사용하니 완전 편리하다.

인덱스 정보까지 출력해주니 보기에도 좋다.



(gdb) set $i=0
(gdb) while($i < 115)
>printf "[%d] %d\n", $i, pTrct->pStRequest->test_parsed_msg.test_header_index[$i].test_current_sub_index
>set $i=$i+1
>end




* 참고한 페이지

https://ftp.gnu.org/old-gnu/Manuals/gdb/html_node/gdb_191.html

https://sourceware.org/gdb/onlinedocs/gdb/Symbols.html



2016.11.17


(gdb) info threads

(gdb) bt full

(gdb) info args

(gdb) info locals

(gdb) info variables

(gdb) thread apply all bt           <-- 프로세스 종료 직전 모든 쓰레드의 백 트레이스 정보


(gdb) x/256x 0x1234abcd         <-- x/개수x 주소



현재 버퍼의 index를 확인하고 그에 대한 버퍼의 내용 조회하는 명령



# cltr_memory_datashm_dump(data_shm, &_cltr_bkup.msg[cnt++], bkup_period)

# [전달하는 변수 값 확인]

(gdb) p cnt

 

$47 = 14

# [백업 버퍼의 정보를 cnt 값으로 조회]

(gdb) p *_stcltr_note.bnote@14




* 참고한 페이지


http://www.delorie.com/gnu/docs/gdb/gdb_25.html

http://yusufonlinux.blogspot.kr/2010/11/debugging-core-using-gdb.html

반응형

참고: http://stackoverflow.com/questions/22489398/unsupported-major-minor-version-52-0


빌드는 1.8 JDK에서 해놓고 톰캣에 올려서 돌릴때는 1.7 JDK에서 돌린 경우 발생할 수도 있다고하는데
역시나.. ㅜ.ㅜ


OS: ubuntu 14.04

# update-alternatives --config java
대체 항목 java에 대해 (/usr/bin/java 제공) 3개 선택이 있습니다.

  선택       경로                                          우선순� 상태
------------------------------------------------------------
* 0            /usr/lib/jvm/java-8-oracle/jre/bin/java          1072      자동 모드
  1            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1071      수동 모드
  2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1069      수동 모드
  3            /usr/lib/jvm/java-8-oracle/jre/bin/java          1072      수동 모드



# vi /etc/default/tomcat7

JAVA_HOME=/usr/lib/jvm/java-8-oracle


# service tomcat7 restart


 이제 정상 동작..


반응형

+ Recent posts