주제는 여기서부터 시작됩니다---https://superuser.com/questions/525110/installing-network-simulator-ns-2-allinone-on-linux-mandriva
특정 에뮬레이터가 있습니다 -NS-2.
이는 네트워크 토폴로지, 트래픽 소스 및 대상 구성, 모든 연결 매개변수(대역폭, 대기 시간, 패킷 손실 확률 및 시뮬레이션된 시스템의 기타 여러 매개변수)를 설명하는 데 사용할 수 있습니다.
에 설치했어요리눅스 맨드레와 2008효과가있다.
하지만 시각화하는 것은 불가능합니다. 그 이유는 다음과 같습니다.도래 송곳.
간단한 예제를 구현하려고 합니다(코드를 다시 반복합니다) -
ns-simple.tcl:
#Create a simulator object
set ns [new Simulator]
#Define different colors for data flows (for NAM)
$ns color 1 Blue
$ns color 2 Red
#Open the NAM trace file
set nf [open out.nam w]
$ns namtrace-all $nf
#Define a 'finish' procedure
proc finish {} {
global ns nf
$ns flush-trace
#Close the NAM trace file
close $nf
#Execute NAM on the trace file
exec nam out.nam &
exit 0
}
#Create four nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
#Create links between the nodes
$ns duplex-link $n0 $n2 2Mb 10ms DropTail
$ns duplex-link $n1 $n2 2Mb 10ms DropTail
$ns duplex-link $n2 $n3 1.7Mb 20ms DropTail
#Set Queue Size of link (n2-n3) to 10
$ns queue-limit $n2 $n3 10
#Give node position (for NAM)
$ns duplex-link-op $n0 $n2 orient right-down
$ns duplex-link-op $n1 $n2 orient right-up
$ns duplex-link-op $n2 $n3 orient right
#Monitor the queue for link (n2-n3). (for NAM)
$ns duplex-link-op $n2 $n3 queuePos 0.5
#Setup a TCP connection
set tcp [new Agent/TCP]
$tcp set class_ 2
$ns attach-agent $n0 $tcp
set sink [new Agent/TCPSink]
$ns attach-agent $n3 $sink
$ns connect $tcp $sink
$tcp set fid_ 1
#Setup a FTP over TCP connection
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ftp set type_ FTP
#Setup a UDP connection
set udp [new Agent/UDP]
$ns attach-agent $n1 $udp
set null [new Agent/Null]
$ns attach-agent $n3 $null
$ns connect $udp $null
하지만 오류 메시지가 나타납니다.
[root@localhost ...]# startx -- :1
xauth: creating new authority file /root/.serverauth.20336
X Window System Version 1.3.0
Release Date: 19 April 2007
X Protocol Version 11, Revision 0, Release 1.3
Build Operating System: Linux_2.6.12-12mdksmp Mandriva
Current Operating System: Linux localhost 2.6.22.9-desktop-1mdv #1 SMP Thu Sep 27 04:07:04 CEST 2007 i686
Build Date: 01 October 2007
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Module Loader present
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/var/log/Xorg.1.log", Time: Sat Dec 29 18:59:34 2012
(==) Using config file: "/etc/X11/xorg.conf"
Using vt 8
(**) RADEON(0): RADEONPreInit
(II) Module already built-in
(II) Module already built-in
(II) Module already built-in
(**) RADEON(0): RADEONScreenInit d0000000 0
(**) RADEON(0): Map: 0xd0000000, 0x01000000
(**) RADEON(0): RADEONSave
(**) RADEON(0): RADEONSaveMode(0x823a6a0)
(**) RADEON(0): Read: 0x00000006 0x00030047 0x00000000
(**) RADEON(0): Read: rd=6, fd=71, pd=3
(**) RADEON(0): RADEONSaveMode returns 0x823a6a0
(**) RADEON(0): RADEONInitMemoryMap() :
(**) RADEON(0): mem_size : 0x04000000
(**) RADEON(0): MC_FB_LOCATION : 0xd3ffd000
(**) RADEON(0): MC_AGP_LOCATION : 0xffffffc0
(**) RADEON(0): RADEONModeInit()
1024x768 78.75 1024 1040 1136 1312 768 769 772 800 (16,16) +H +V
1024x768 78.75 1024 1040 1136 1312 768 769 772 800 (16,16) +H +V
(**) RADEON(0): Pitch = 8388736 bytes (virtualX = 1024, displayWidth = 1024)
(**) RADEON(0): dc=7875, of=15750, fd=350, pd=2
(**) RADEON(0): RADEONInit returns 0x823b050
(**) RADEON(0): RADEONRestoreMode()
(**) RADEON(0): RADEONRestoreMemMapRegisters() :
(**) RADEON(0): MC_FB_LOCATION : 0xd3ffd000
(**) RADEON(0): MC_AGP_LOCATION : 0xffffffc0
(**) RADEON(0): Map Changed ! Applying ...
(**) RADEON(0): Map applied, resetting engine ...
(**) RADEON(0): Updating display base addresses...
(**) RADEON(0): Memory map updated.
(**) RADEON(0): Programming CRTC1, offset: 0x00000000
(**) RADEON(0): Wrote: 0x0000003c 0x0001015e 0x00000000 (0x0000bf00)
(**) RADEON(0): Wrote: rd=60, fd=350, pd=1
(**) RADEON(0): GRPH_BUFFER_CNTL from 20005c5c to 20055c5c
(**) RADEON(0): RADEONSaveScreen(0)
(**) RADEON(0): Setting up initial surfaces
(**) RADEON(0): Initializing fb layer
(**) RADEON(0): Setting up accel memmap
(**) RADEON(0): Initializing backing store
(**) RADEON(0): Setting up final surfaces
(**) RADEON(0): Initializing Acceleration
(**) RADEON(0): EngineInit (16/16)
(**) RADEON(0): Pitch for acceleration = 128
(**) RADEON(0): EngineRestore (16/16)
(**) RADEON(0): Initializing DPMS
(**) RADEON(0): Initializing Cursor
(**) RADEON(0): Initializing color map
(**) RADEON(0): Initializing DGA
(**) RADEON(0): Initializing Xv
(**) RADEON(0): RADEONScreenInit finished
(EE) AIGLX: Screen 0 is not DRI capable
(**) RADEON(0): RADEONSaveScreen(2)
달리기나노초:
[root@localhost ...]# export DISPLAY=localhost:1
[root@localhost ...]# ns ns-simple.tcl
CBR packet size = 1000
CBR interval = 0.0080000000000000002
[root@localhost ...]# **nam: couldn't connect to display "localhost:1"**
재건축을 하려고 합니다남쪽, 그들이 말하는 대로여기, 내 remote-create-animator
기능은 다음과 같습니다 -
AnimControl instproc remote-create-animator {trace_file args} {
catch "array set opts $args"
AnimControl instvar PORT_FILE_
if [catch {set f [open $PORT_FILE_ RDONLY]}] {
error "Cannot read server port from $PORT_FILE_"
}
set port [read $f]
close $f
puts -nonewline "Cannot connect to existing nam instance. "
puts "Starting a new one..."
$self local-create-animator $trace_file [join $args]
#if [catch {set sock [socket localhost $port]}] {
# puts -nonewline "Cannot connect to existing nam instance. "
# puts "Starting a new one..."
# $self local-create-animator $trace_file [join $args]
#} else {
# if {$trace_file == ""} {
# puts "A nam instance already exists. Use nam <trace file> to view an animation"
# close $sock
# } else {
# global tcl_platform
# if {$tcl_platform(platform) == "windows"} {
# if [regexp {^(\\\\|[A-Za-z]:[/\\])} $trace_file] {
# set tf $trace_file ;# Absolute pathname
# } else {
# set tf [pwd]/$trace_file ;# Relative pathname
# }
# } else {
# if [regexp {^[~/]} $trace_file] {
# set tf $trace_file ;# Absolute pathname
# } else {
# set tf [pwd]/$trace_file ;# Relative pathname
# }
# }
# puts $sock "CA $tf [join $args]"
# flush $sock
# close $sock
# }
#}
}
그러나 아무것도 변하지 않았습니다. 최근 소식은——"Cannot connect to existing nam instance. Starting a new one..."
그리고 다..
사진을 얻는 방법? 정보를 제공해 주시면 매우 감사하겠습니다!
감사해요!
답변1
NS2를 오랫동안 사용하지 않았지만 제 기억이 맞다면 X11 터널에 문제가 있는 것일 수도 있습니다. NS2를 실행하는 Linux 서버에 연결하기 위해 SSH를 사용하고 있습니까? xclock을 입력해 시계가 보이는지 확인하세요. SSH를 사용하는 모든 프로그램에서 터널링을 활성화해야 합니다.
퍼티를 사용하는 경우 X11 아래의 터널을 확인하십시오.
또한 Xserver가 실행 중인지 확인해야 합니다(저는 개인적으로 Xming을 사용합니다).
답변2
나는 다음을 수행했습니다.
설치하다스타밍 6.9.0.31
X-앞으로:
1)DISPLAY
bashrc
및 에서 bash_profile
변수 제거/etc/profile
2)파일에/etc/ssh/sshd_config다음을 추가했습니다.
...
ListenAddress ip_of_remote_server
...
삼)주석 해제:
...
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes
...
4)퍼티 설정:
SSH->X11:
Enable X11 forwarding;
X display location: localhost:0;
그런 다음 다음 명령을 실행하십시오.
[root@localhost ...]# echo $DISPLAY
localhost:11.0
[root@localhost ...]# ns ns-simple.tcl
CBR packet size = 1000
CBR interval = 0.0080000000000000002
[root@localhost ...]# Cannot connect to existing nam instance. Starting a new one...
그때 등장했다---
이제 모든 것이 괜찮습니다. 감사합니다!